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

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.