Help - Search - Members - Calendar
Full Version: Automatically Update Image Slider On All Pages
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
Azercii
Hello,

I'm curious if there is any easier way to have my image slider automatically update, maybe through some form of inheritance perhaps? Rather than going through all the pages manually editing the descriptions and links (the images are stored local to the pages).


Slider Code

CODE
<div id="sliderFrame">
        <div id="slider">
            <a href="http://www.dota2.com/news/updates/" target="_blank"><img src="image-slider-1.jpg" alt="Catch up on the latest patch news from the world of DotA!" /></a>
            <a href="http://cfgfactory.com/news.php" target="_blank"><img src="image-slider-2.jpg" alt="Into modding? This is the site for you!" /></a>
            <a href="http://na.leagueoflegends.com/en/news/game-updates/patch" target="_blank"><img src="image-slider-3.jpg" alt="Catch up on the latest patch news from the world of League of Legends!" /></a>
            <a href="http://www.computerandvideogames.com/452805/early-titanfall-players-with-legit-copies-wont-be-banned/" target="_blank"><img src="image-slider-4.jpg" alt="Early Titanfall players with legit copies won't be banned" /></a>
            <a href="http://www.computerandvideogames.com/452752/the-last-of-us-film-in-the-works-at-screen-gems/" target="_blank"><img src="image-slider-5.jpg" alt="The Last of Us film in the works at Screen Gems" /></a>
        </div>
    </div>




Site
Cloud Gaming
CharlesEF
You mean you want to change the code you posted once and let the changes flow to all your pages? The only way I know to do this is to use 'includes'. This is done on the server side so if you don't have access to the server files (and PHP or ASP, etc...) then I can't help you.
Azercii
That is indeed what I'm wanting to do! smile.gif


SSI? I did try a test code from a site earlier;

CODE
<HTML>
<TITLE>Test File</TITLE>

<!--#config timefmt="%A" --> <!--#echo var="DATE_LOCAL" -->

</HTML>



To which I got nothing back except a blank page, tried saving as .shtml and all I received was a read-back of the code itself (including tags). It's only a freehost, so I wouldn't expect anything amazing (might have to ring them about it).
jimlongo
I've always found SSI includes more difficult than using PHP includes.

You would have your code from above stored as (for example) slideshow.html and then in your various pages.html (assuming your .htaccess is setup to allow php in html pages) or pages.php you would include that file by including it as follows.

<?php include 'slideshow.html'; ?>
Azercii
You, are, a time-saver! Haha I apologize if it was an easy-to-find fix, my Brain is half-dead right now and I couldn't think of a correct term except "Inherit" smile.gif
CharlesEF
QUOTE(Azercii @ Mar 17 2014, 10:49 AM) *

That is indeed what I'm wanting to do! smile.gif


SSI? I did try a test code from a site earlier;

CODE
<HTML>
<TITLE>Test File</TITLE>

<!--#config timefmt="%A" --> <!--#echo var="DATE_LOCAL" -->

</HTML>



To which I got nothing back except a blank page, tried saving as .shtml and all I received was a read-back of the code itself (including tags). It's only a freehost, so I wouldn't expect anything amazing (might have to ring them about it).

The code you posted does not look like the 'include' I'm talking about. Your code seems to be commented out, so nothing will show on the page. Jim's post is more along the lines of what I was talking about.
pandy
In the same way SSI needs to be enabled. If your pages are .php it is not, so that could explain why it didn't work. If you already use PHP there is no reason to use SSI, in fact I don't think you can use both at the same time, but it's a long time since I googled that.

I think SSI is very handy, but since most hosting plans have PHP now and most sites use that, SSI isn't used as often as it was back in the day.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.