Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Dynamic a href in HTML - Help

  1. #11
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Like I said before, you can include almost anything so you don't need to change the name of the file you are including. If you mean the name of the file which has this code, then you can use the .htaccess code I wrote before to be able to have the php code in html files.
    Last edited by Snookerman; 12-10-2008 at 05:15 PM. Reason: sp

  2. The Following User Says Thank You to Snookerman For This Useful Post:

    me_myself (12-10-2008)

  3. #12
    Join Date
    Aug 2007
    Location
    MO USA
    Posts
    106
    Thanks
    37
    Thanked 0 Times in 0 Posts

    Default

    thanks a lot my friend

  4. #13
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    For others coming across this thread, a small clarification/rephrasing...

    The solution that Snookerman suggests basically tells the server to parse your HTML files through the PHP handler. This means that you can add PHP code within your HTML files. So, the .htaccess rule takes away the necessity to have a .php extension. This is useful if you're not at liberty to rename all of your website files.

  5. The Following User Says Thank You to Medyman For This Useful Post:

    me_myself (12-11-2008)

  6. #14
    Join Date
    Jun 2010
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help please.

    Hi guys,

    Can I used the HTML markup below, save it as highslidegallery.html or highslidegallery.php and include inside a <td> using

    <?php
    include('/highslidegallery.html');
    ?>

    I'm new to web design and would appreciate any expert comments/help.

    Basically I have four "mini-galleries" on my gallery page and the page is infinite with the HTML mark up. All I want is to keep it nice and tidy, and if possible link/load it externally/dynamically using PHP. Can this be achieved?

    Thanks for your time. Much appreciated.


    <div class="highslide-gallery">
    <a id="thumb1"href="highslide/images/1.jpg" class="highslide"
    title="This is just an image"
    onclick="return hs.expand(this, config1 )">
    <img src="highslide/images/1thumb.jpg" alt=""/>
    </a>
    <div class="hidden-container">
    <a href="highslide/images/2.jpg" class="highslide"
    title="Caption from the anchor's title attribute"
    onclick="return hs.expand(this, config1 )">
    <img src="highslide/images/2thumb.jpg" alt=""/>
    </a>
    <a href="highslide/images/3.jpg" class="highslide"
    title="Caption from the anchor's title attribute"
    onclick="return hs.expand(this, config1 )">
    <img src="highslide/images/3thumb.jpg" alt=""/>
    </a>
    <a href="highslide/images/4.jpg" class="highslide"
    title="Caption from the anchor's title attribute"
    onclick="return hs.expand(this, config1 )">
    <img src="highslide/images/4thumb.jpg" alt=""/>
    </a>
    <a href="highslide/images/5.jpg" class="highslide"
    title="Caption from the anchor's title attribute"
    onclick="return hs.expand(this, config1 )">
    <img src="highslide/images/5thumb.jpg" alt=""/>
    </a>
    <a href="highslide/images/6.jpg" class="highslide"
    title="Caption from the anchor's title attribute"
    onclick="return hs.expand(this, config1 )">
    <img src="highslide/images/6thumb.jpg" alt=""/>
    </a>
    <a href="highslide/images/7.jpg" class="highslide"
    title="Caption from the anchor's title attribute"
    onclick="return hs.expand(this, config1 )">
    <img src="highslide/images/7thumb.jpg" alt=""/>
    </a>
    <a href="highslide/images/8.jpg" class="highslide"
    title="Caption from the anchor's title attribute"
    onclick="return hs.expand(this, config1 )">
    <img src="highslide/images/8thumb.jpg" alt=""/>
    </a>
    <a href="highslide/images/9.jpg" class="highslide"
    title="Caption from the anchor's title attribute"
    onclick="return hs.expand(this, config1 )">
    <img src="highslide/images/9thumb.jpg" alt=""/>
    </a>
    <a href="highslide/images/10.jpg" class="highslide"
    title="Caption from the anchor's title attribute"
    onclick="return hs.expand(this, config1 )">
    <img src="highslide/images/10thumb.jpg" alt=""/>
    </a>
    <a href="highslide/images/11.jpg" class="highslide"
    title="Caption from the anchor's title attribute"
    onclick="return hs.expand(this, config1 )">
    <img src="highslide/images/11thumb.jpg" alt=""/>
    </a>
    </div>
    </div>

  7. #15
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    Cubikated ! Yes you can do that. If you save your frontpage as index.php you can include the images as Snookerman said with something like this
    Code:
    <?php
    include('highslidegallery-1.html');
    ?>
    And you can include several more image arrays the same way other places on your page. I am assuming it's your frontpage but you can do it with any page as long as it has php extension. Snookerman mentions .htacces but you dont need to mess with that as long as you save the page as .php.

  8. #16
    Join Date
    Jun 2010
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hummmmmm....now that's a problem cos I have all my pages as .html

    How do I convert all my pages to .php without loosing any thing?

    Do I have to install something like WampServer?

  9. #17
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    Do you need the image galleries on many pages ?
    If yes, then you can change the .htacces as Snookerman explains and that way avoid having to change to php extension. If you only need the imagegalleries on one or two pages then just save it as .php instead of html. You don't loose anything that way. You can't see .php pages locally as a default so either you have to upload to a server online or you can install wampserver, as you say, and run it from there.

  10. #18
    Join Date
    Jun 2010
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you very much for that. I've successfully converted all my pages to .php by just renaming in Dreamweaver. Had to go through another YouTube tutorial on how to install WampServer and how to define a php site in Dreamweaver. Success again

    Now I need to try the "include" function and see if I can get it to work.

    My brain's overworked......need a holiday soon!!!!

  11. #19
    Join Date
    Jun 2010
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi azoomer,

    Just a quick question.

    As I said before I converted all my .html to .php in Dreamweaver and the page looks exactly like before. I'm just wondering if I should add a


    <?php

    <html>
    <head>
    <title></title>
    </head>
    <body>


    </body>
    </html>

    ?>

    and just add anywhere I want

    include('highslidegallery-1.html'); (keeping in mind that I've added the <?php ?> before and after the <html> </html> tags)

    or do I have to add each time

    <?php
    include('highslidegallery-1.html'); (keeping in mind that I've added the <?php ?> before and after the <html> </html> tags)
    ?>

    where I want to include the file.

    Thanks for your help, much appreciated!!!!

  12. #20
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    you should add it with each include and not around the html tags.

Tags for this Thread

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
  •