1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

using lightbox in PHP scripts

Discussion in 'PHP' started by sp360, Mar 19, 2007.

  1. #1
    hey, i got a image hosting script, and its all php, and i want to use lightbox with it since i got a section where members can view there uploaded pictures, but the thing is when i try <script type="text/javascript" src="lightbox.js"></script> it doesnt work, and when i try include() it just shows the .js code, any body knows how to do it within PHP??
     
    sp360, Mar 19, 2007 IP
  2. jwalsh

    jwalsh Peon

    Messages:
    8
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    lightbox is a client side javascript library, not a server side php library. You don't need to do anything with PHP to make it work.
     
    jwalsh, Mar 19, 2007 IP
  3. designcode

    designcode Well-Known Member

    Messages:
    738
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    118
    #3
    where you are printing images, use rel="lightbox". and it will work.

    for instance

    <a href="yourbigimg.gif" rel="lightbox" title="Blah"><img src="yoursmallimg.gif" alt="Blah" class="thumbnails2" /></a>
     
    designcode, Mar 19, 2007 IP
  4. designcode

    designcode Well-Known Member

    Messages:
    738
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    118
    #4
    Also include all js files right before <head>

    <script type="text/javascript" src="/templates/default/javascripts/prototype.js"></script>
    <script type="text/javascript" src="/templates/default/javascripts/scriptaculous.js?load=effects"></script>
    <script type="text/javascript" src="/templates/default/javascripts/lightbox.js"></script>

    Peace
    designcode
     
    designcode, Mar 19, 2007 IP
  5. sp360

    sp360 Well-Known Member

    Messages:
    1,023
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    160
    #5
    designcode: i allready tried that and it didnt work
    i think what jwalsh said is right
     
    sp360, Mar 19, 2007 IP
  6. designcode

    designcode Well-Known Member

    Messages:
    738
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    118
    #6
    No I have implemented this thing on many projects, I am sure you are missing something, perhaps you are not including js files on right place. Gimme the demo url and then I can tell you exact problem.
     
    designcode, Mar 19, 2007 IP
  7. sp360

    sp360 Well-Known Member

    Messages:
    1,023
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    160
    #7
    the demo is running on my IP so i dunt want my ip to be on ouublic forums, and plus the script is all php, thier is no <head> tags in it either
     
    sp360, Mar 20, 2007 IP
  8. jwalsh

    jwalsh Peon

    Messages:
    8
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    You will need to include the lightbox.js within the <head> tags of your file. If you don't have these tags, I would start by adding them.

    You're page won't validate without <head> tags either.
     
    jwalsh, Mar 20, 2007 IP