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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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\">";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.