Jump to content

This should be challenging!


JeepFreak

Recommended Posts

  
  function slicky_links($dirname, $filename, $page)
  {
    $imgurl = "http://www.slicky.net/gallery.php?cmd=midsize&gallery=$dirname&image=$filename";
    $linkurl = "http://www.slicky.net/gallery.php?gallery=$dirname&page=$page";
    
    $htmlcode = '<a href=' . $linkurl . '><img src=' . $imgurl . '></a>';
    
    echo "<a href=\"Javascript:copy('$htmlcode');\">HTML Code</a>";  
  }

 

 

OK, so this function works well... It creates a link called "HTML Code" which copies the link code to my clipboard.  An example of the copied text would look like this:

<a href=http://www.slicky.net/gallery.php?gallery=sample/&page=1><img src=http://www.slicky.net/gallery.php?cmd=midsize&gallery=sample/&image=IMG_0722.jpg></a>

 

There's only one problem... the syntax is wrong.  I need it to insert quotes around the image source url and the link url.  I can't get it to work... it just keeps breaking up the original link code >:(

 

Anybody know how to get it working?

 

Thank you!

Billy

Link to comment
https://forums.phpfreaks.com/topic/116650-this-should-be-challenging/
Share on other sites

change

$htmlcode = '<a href=' . $linkurl . '><img src=' . $imgurl . '></a>';

to

$htmlcode = '<a href="' . $linkurl . '"><img src="' . $imgurl . '"></a>';

 

Wont work well here

echo "<a href=\"Javascript:copy('$htmlcode');\">HTML Code</a>"; 

 

You might want to try using entities? " ? I'm not comfortable enough with javascript to know whether this would work off-hand.

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.