Jump to content

[SOLVED] can this echo statement be done completely with php?


Reaper0167

Recommended Posts

<?php
echo "<a href=\"{$row['thumb_1']}\" onClick=\"window.open('{$row['imgpath']}', width=700); return false\"><img src=\"{$row['thumb_1']}\" width=\"100\" alt=\"\" border=\"0\"></a>";
?>

 

onclick is javascript, right. I would like to get rid of this and just use php

Not necessarily, it depends on what its used for. For instance, common usage is to track how many times a link is clicked, this can however easily be done, by keeping the link internal, and simply redirecting the user.

 

I wouldn't however worry that much about using JavaScript, it has many good uses, and virtually everyone has it enabled these days. You should however provide an alternative for search engines, if you want something to be indexed. Etc.

I don't want to get off subject, but with the code i mentioned above, in ie i can click on the thumbnail and it opens a new window with the full size pic, but in firefox, i click on the thumbnail, and it shows the thumbnail again. That is why I would love for it to be all PHP. I am waiting patiently in the javascript section for a reply. Again, sorry to mention the javascript in this section.

For instance, common usage is to track how many times a link is clicked,

 

I am not so sure. I thing the most common usage is just to open a simple new pop up window, or do some things with other controls on the page onclick, or something like these. But yup, it depends on usage, how u want to use. Though most of the onclick functions cannot be replicated by php.

i wud do this like this

<?php
echo "<a href=\"{$row['thumb_1']}\" onClick=\"window.open('showimage.php?loc={$row['imgpath']}', 'window_name', 'width=700'); return false\"><img src=\"{$row['thumb_1']}\" width=\"100\" alt=\"\" border=\"0\"></a>";
?>

 

showimage.php

echo "<img src=\"".$_GET['loc']."\" width=\"100\" alt=\"\" border=\"0\">";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.