Excel VBA tutorials to enhance WordPress pages - #12 - FTP Uploader & Web editor

Опубликовано: 21 Ноябрь 2014
на канале: RedCityProjects
327
1

Coding for video see below

Save these notes in NotePad and edit as necessary.

Set up Excel worksheet with album headers in row 7 with album names in column C

VBA code

Sub album_File()

Dim n, ro, col, total As Integer
Dim outputCSV As String
Dim S As String

S = " , "
total = 5

Worksheets("Albums").Select

[c7].Select

ro = ActiveCell.Row
col = ActiveCell.Column

For n = 0 To total

If n = 0 Then
outputCSV = outputCSV + CStr(total)
Else
outputCSV = outputCSV + CStr(n)
End If

outputCSV = outputCSV + S + CStr(Cells(ro + n, col)) + S + CStr(Cells(ro + n, col + 1)) + S + CStr(Cells(ro + n, col + 2))
outputCSV = outputCSV + S + CStr(Cells(ro + n, col + 3)) + S + CStr(Cells(ro + n, col + 4)) + S + CStr(Cells(ro + n, col + 5))
outputCSV = outputCSV + S + CStr(Cells(ro + n, col + 6)) + S + CStr(Cells(ro + n, col + 7)) + S + CStr(Cells(ro + n, col + 8))
outputCSV = outputCSV + S + CStr(Cells(ro + n, col + 9)) + S + CStr(Cells(ro + n, col + 10)) + S + CStr(Cells(ro + n, col + 11)) + S + Chr$(10)

Next

openOutput "C:\Users\Dick\Desktop\phpFolder\ftpFolder\historic_albums.txt", outputCSV

End Sub



Sub execAlbumUploader()

album_File

ftp_Uploader

End Sub


Sub openOutput(filePath, outputFile As String)

Open filePath For Output As #1
Print #1, outputFile
Close #1

End Sub


-------------------------------------


PHP Code

SEARCH Page

For most of this code see earlier videos eg video #11

These lines should be substituted:

new file name - historic_albums.txt

$open_file = fopen('wp-content/phpFolder/ftpFolder/historic_albums.txt', "r");

new array name - $album_data

if ($string_position!==false) { $album_data = explode(' , ',$row);}

new $textoutput strings

$textoutput= $album_data[9] . $album_data[4] . $album_data[8];


MAIN Page PHP


[insert_php]

// index 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
//album order "ID , Album , Year , Artists , First Para , Video link , Tracks , Album Data , Personnel , History , Image1 , Image2 , Copyright"

$album_id= htmlspecialchars($_GET["album"]);
$open_file = fopen('wp-content/phpFolder/ftpFolder/historic_albums.txt', "r");

$line = fgets($open_file);
$check= explode(' , ',$line);

// NOTE Youtube 'Description' does not allow certain characters; the first +++ below is the 'greater than' symbol (Ascii 62) and ++ is the 'less than' symbol (Ascii 60)

if ($album_id +++ $check[0] or $album_id ++ 1){exit ("No such record");}

// NOTE the first ++ should be 'less than'; leave the second as it is;

for ($x=1; $x++=$album_id; $x++) {
$line = fgets($open_file);}

$album= explode(' , ',$line);
fclose($open_file);

// NOTE: Youtube 'Description' does not allow HTML characters so change ++ into the opening bracket (Ascii 60) and +++ into the closing bracket (Ascii 62)


print "++ h3 +++ From the year " . $album[2] . "++ /h3 +++
Album: " . $album[1] . " Artists: " . $album[3] ;

print $album[4];

print "++ div style='float:right; margin-top:30px; text-align:right;' +++". $album[5] . "
++ a href='http://www.play.com/Music/CD/6-/Regio... +++ buy this album at play.com ++/a+++ ++/div +++"
. $album[6] . " ++ p +++";

print "Album details: " . $album[7];

print "++ div style='float:right;margin-top:40px; margin-left:10px;'+++ ++ img width='310' src='/wp-content/phpFolder/images/"
. $album[10] . " '/+++ ++ /div +++";

print "++ div style='float:right;margin-top:60px; margin-left:10px;' +++ ++ img width='310' src='/wp-content/phpFolder/images/"
. $album[11] . " '/ +++ ++ /div +++" . $album[8];

print "++ p +++" . $album[9] . "Copyright Information " . $album[12] ;

[/insert_php]


End Part XII


Смотрите видео Excel VBA tutorials to enhance WordPress pages - #12 - FTP Uploader & Web editor онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь RedCityProjects 21 Ноябрь 2014, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 32 раз и оно понравилось людям.