Results 1 to 4 of 4

Thread: Lightbox viewer w/ PHP-link call = No go.. please help

  1. #1
    Join Date
    Jun 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Lightbox viewer w/ PHP-link call = No go.. please help

    1) Script Title: Lighbox viewer (both versions)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tbox/index.htm

    3) Describe problem: Image won't load

    The actual syntax for executing the script is:
    <a href="dog.jpg" rel="lightbox" ><img src="dog_thumb.jpg" /></a>

    What I'm trying to do:
    <a href="<?php echo $this->getGalleryUrl($_image) ?>" rel="lightbox">

    The only difference being that I'm putting in a PHP-link call in href instead of the actual image link, which btw I do not know as I'm working on a shopping cart and it keeps its own track of URLs.

    I've done all the basics right, and I can even see the script run up to the point where it loads the image, but the image never shows up. Apparantly, lighbox doesn't like indirect image URLs. Any possible soluions? I'd imagine a few tweaks in the .js file will do me good, but i'm no hardcore coder so any bit of help is highly appreciated.

    Oher info: that little piece of PHP code above is correct, and seems to work well with DHTML pop-up scripts.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    If the PHP code is executing properly, lightbox has no way of knowing it's there, as it is exactly the same on the client side (where lightbox operates) as any hard coded URL.

    I do know that in PHP, unlike in javascript, semicolons must terminate statements like echo, setting variables, etc. So your code should at least be:

    Code:
    <a href="<?php echo $this->getGalleryUrl($_image); ?>" rel="lightbox">
    Additionally, I am not familiar with the:

    PHP Code:
    $this-> 
    syntax, it looks wrong to me, but that could just be my inexperience with PHP.

    One way to test if your PHP token is getting resolved as expected is to look at the live page with the browser's 'view source'. It will show exactly how the code is being served. If it doesn't look right there, the PHP part is messing up somewhere. It could be the token itself, how it's written or the value it contains that's off though, or a combination.

    It's also possible that your code could be correct (but I'm pretty sure about it's needing that semicolon), but that the image path and filename it produces points to a non-existent file.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    If the PHP code is executing properly, lightbox has no way of knowing it's there, as it is exactly the same on the client side (where lightbox operates) as any hard coded URL.

    I do know that in PHP, unlike in javascript, semicolons must terminate statements like echo, setting variables, etc. So your code should at least be:

    Code:
    <a href="<?php echo $this->getGalleryUrl($_image); ?>" rel="lightbox">
    Additionally, I am not familiar with the:

    PHP Code:
    $this-> 
    syntax, it looks wrong to me, but that could just be my inexperience with PHP.

    One way to test if your PHP token is getting resolved as expected is to look at the live page with the browser's 'view source'. It will show exactly how the code is being served. If it doesn't look right there, the PHP part is messing up somewhere. It could be the token itself, how it's written or the value it contains that's off though, or a combination.

    It's also possible that your code could be correct (but I'm pretty sure about it's needing that semicolon), but that the image path and filename it produces points to a non-existent file.
    The PHP part is perfectly legit, and I know this for sure because I can get the following to work,

    <a href="#" onClick="getemail=dhtmlmodal.open('imgbox', 'iframe', '<?php echo $this->getGalleryUrl($_image) ?>','', 'width=600px,height=480px,center=1,resize=1,scrolling=0'); return false">

    You can see the call function is the same for both, only the way it's manipulated differs. Unfortunately, the particular DHTML script offered on DD doesn't suit my likes, so I'm fairly desperate to get lightbox script to work for me. Do you think you can re-do some code in lightbox.js file?

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Please post a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •