PDA

View Full Version : Setting which pagination link is highlighted



mamaduck
12-05-2007, 03:10 AM
1) Featured Content Slider

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/featuredcontentslider.htm

3) Describe problem:
The featured content slider is working great for me. I have the banner rotating automatically on the home page, leading the user to 4 different landing pages when they click on the tab or the content. Then I have the banner again on the landing page, but not set to autorotate When the user clicks through to the landing page, the tab for that content area is highlighted, because of the cookie the script sets. But if you come to the page via another link, the first pagination link is highlighted, not the "correct" one for that page.
What I want to know is, is there anyway to set a cookie with the script so that a specific tab/content div is highlighted/visible.

Thanks very much for all your help!

ddadmin
12-05-2007, 09:57 AM
There are a few ways of passing information from one page to another, so a script on the receiving page (in this case, Featured Content script) is instructed to do something accordingly. One of the ways talked about on the forums is using a URL itself to pass information. For example, this thread talks about how to get a particular tab within Ajax Tabs Content script (http://www.dynamicdrive.com/forums/showthread.php?t=26799) to be selected if a user is coming from a specific URL: http://www.dynamicdrive.com/forums/showthread.php?t=26799 Will a similar technique basically fit your need here?

mamaduck
12-05-2007, 05:44 PM
If I understand correctly, that would work by placing a certain parameter on a link external to the page with the tabs, so that when they go to the page with the tabs, the correct tab would be highlighted. What I had in mind was something that wouldn't be dependent on the external link, so for example if the user clicked on a search engine result or a link on another web site, the correct tab would be highlighted on the page.

ddadmin
12-06-2007, 02:14 AM
Yes, your understanding is correct. What you're asking is possible, but without using the URL of the browser to tell the script which featured content should be selected based on the page the script is in, you'll need to find another method. One obvious choice is to use the Real URLs version (http://www.dynamicdrive.com/forums/showthread.php?t=26816) of this script to assign actual URLs to the pagination links of each featured content. For the featured content that you wish to be selected by default when the script is in a particular page, for example, "cat.htm", you would assign that URL to the pagination link in question.

Putting it all together, first, download the below contentslider.js file, which is the most recent version of the stock script, with Real URLs added, plus the ability talked about above. Then, you would call the script using something like:


<div class="pagination" id="paginate-slider1"></div>

<script type="text/javascript">
//Define: ContentSlider("slider_ID", [autorotate_miliseconds], [custompaginatelinkstext], [customnextlinktext])
ContentSlider("slider1", 5000, "", "", ['dog.htm', 'cat.htm', 'deer.htm', 'bear.htm'] )

</script>

The key is the part in bold- that's the real URLs option at work. One of the URLs, in this case, the red URL, then would correspond to the filename of the page that when the script is called in, will cause the featured content with pagination link "cat.htm" to be selected by default. In other words, if Feature Content script was added to the page "cat.htm", when that page is loaded, the corresponidng featured content will be selected by default as well.

If you're confused, just post here, but that's the general idea.

mamaduck
12-06-2007, 05:14 PM
I was working with a version of the Real URL's with a further option that clicking on the URL's goes to the actual link, from this thread: http://www.dynamicdrive.com/forums/showthread.php?t=26816

Is there any easy way to add on the clickability option to the script? I think this combination of functionality is going to be very useful in lots of situations.

ddadmin
12-06-2007, 09:41 PM
Do you mean so clicking on a pagination link takes the user to an actual URL, instead of toggle between the featured contents?

mamaduck
12-07-2007, 05:51 PM
yes, exactly.

mamaduck
12-07-2007, 08:48 PM
Actually what I need is more like the Tab Content Script, maybe, but with a fade in.
I need to have the correct tab selected and content displayed when the user loads the page, and then have the div swap content when they mouseover another tab, but then swap back to the original content when they mouseout.