shauniqua Posted December 24, 2008 Share Posted December 24, 2008 Please see: http://www.davidsongalleries.com/artists/moreau/moreau.php The images and their corresponding texts are generated using this short script: function artinfo(file,artist,linked,medium,size,price,box) { stats = '<li>\<a href="' + file + '" title="' + artist + '. ' + linked + '. ' + medium + '. ' + size + '. ' + price + '" class="thickbox" rel="' + box + '" onfocus="this.blur();"><img src="th/' + file + '" alt="-thumbnail-" /><br />' + linked + '\</a><br />' + medium + '.<br />' + size + '.<br /><span class="price">' + price + '\</span>\</li>'; document.write(stats); } ...and called like so: artinfo('moreau-awaken_to_terror.jpg','Ben Moreau','Awaken to the Terror of a New Day, 2007','Photopolymer Gravure. Edition of 6','30 x 22 inches','$550','moreau'); I set it up this way to avoid pasting in the same information repeatedly into the two views on the page (using a Thickbox window along with duplicate static page text). There are several hundred pages like this on the site, but each is handled a little differently, so a database was not the best solution. However, using this script, the images and their texts are, of course, not found by search engines. Moreover, they cannot be read by "share" links via Facebook, et al. Ideally, I'd like to be able to create a similar call with PHP, but I'm a total beginner and can't seem to make it work. Is this possible? How would I go about it? Link to comment https://forums.phpfreaks.com/topic/138263-switching-from-javascript-to-php-generating-a-list-of-items/ Share on other sites More sharing options...
ratcateme Posted December 24, 2008 Share Posted December 24, 2008 this should do it <?php function artinfo($file, $artist, $linked, $medium, $size, $price, $box) { $stats = '<li><a href="' . $file . '" title="' . $artist . '. ' . $linked . '. ' . $medium . '. ' . $size . '. ' . $price; $stats .= '" class="thickbox" rel="' . $box . '" onfocus="this.blur();">'; $stats .= '<img src="th/' . $file . '" alt="-thumbnail-" />'; $stats .= '<br />' . $linked . '\</a><br />' . $medium . '.<br />' . $size . '.<br /><span class="price">' . $price . '\</span>\</li>'; echo $stats; } ?> i broke it up and you call call it just the same but it just needs to be inside <?php ?> tags Scott. Link to comment https://forums.phpfreaks.com/topic/138263-switching-from-javascript-to-php-generating-a-list-of-items/#findComment-722935 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.