PDA

View Full Version : Featured Content slider



chas
12-23-2006, 12:24 PM
1) Script Title: Featured Content Slider

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

3) Describe problem:

How do i retrieve data from mysql and display it dynamically as opposed to having prefabricated html??

It might be to slow down the display so that data is retrieved first, coz it looks like no data is inserted into the div.

funny thing is when i look at the source on display it looks like all data is present

ddadmin
12-23-2006, 09:49 PM
If your page is dynamically generated (ie: php page), you should have no trouble using mysql to output the "prefabricated html" portion of the script, which are just DIV tags with the desired contents inside. Remember, with dynamic pages, you control exactly what gets output as the final HTML of the page.

If you're not familar with php/ mysql, you may want to consider just using the Ajax feature in the script to get the contents of each slide as external files.

chas
12-24-2006, 04:16 AM
i see two problem here.

1. the data enclosing DIV is given a CSS of "no display";

2. in a php generated page how do u insert an anchor to get the pagination???

3. and where do i get just the ajax portion???

4. it cant be an external file coz data is retrieved in a loop on an existing page, ie the php loop is providing the data of the content DIVs

djr33
12-24-2006, 04:33 AM
PHP outputs html. If you want a certain tag or setting, etc. just output that.
Like echo '<div class="something" or style="no display".... etc>';

Note that if needed it can autogenerate part or all of the javascript(s) as well.

chas
12-24-2006, 04:48 AM
hmm??

i have php that does a loop.....i can display them horizontally 3+ across with "td", or vertically with "tr"; they show.

i remove those td/tr, and enclosed each looped data in a table and enclosed this table in the DIVS of this script.

i dont see the looped data, and the pagination doesnt work.

So where did i go wrong?

ddadmin
12-24-2006, 08:55 AM
Regarding switching over to using Ajax, to clarify, I mean instead of use PHP to output the contents, you would just embed the script on your page manually, and for the contents, specify the path to them on your server. For example:


<div class="contentdiv" rel="external.htm" >

</div>

This is explained on the script page near the bottom.

Back to PHP, basically the entire HTML for the script is as follows:


<div id="slider1" class="contentslide">

<div class="contentdiv">
Content 1
</div>

<div class="contentdiv">
Content 2
</div>

<div class="contentdiv">
Content 3
</div>

</div>

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

<script type="text/javascript">
//ContentSlider("slider_ID" , opt_miliseconds_rotate)
ContentSlider("slider1") //or ContentSlider("slider1", 3000) to auto rotate every 3 seconds

</script>

Each of the DIVs uses the same pattern as far as structure, so using PHP to output them dynamically should be relatively simple. Your goal is to massage your PHP code to output the above. If the script doesn't work, it's because that's not what's being output.

chas
12-24-2006, 09:20 AM
the php page has full page formatting, heading, footer etc etc....


the only section i need is the loop part in the news section

chas
12-25-2006, 03:04 PM
Hi again,

Its seems a css thing.


.contentslide{

}

.contentslide .contentdiv{
border: 10px solid navy;
border-bottom-width: 6px;
padding: 8px;
width: 400px;
height: 250px;
}


if i take out "display: none;" then all the divs show, but if i use it then nothing show up

ddadmin
12-26-2006, 12:22 AM
Display:none is needed to initially hide all the DIVs and let the script show them one at a time. Did you remember to output the JavaScript code at the bottom to initalize the script, such as:


<script type="text/javascript">
//ContentSlider("slider_ID" , opt_miliseconds_rotate)
ContentSlider("slider1") //or ContentSlider("slider1", 3000) to auto rotate every 3 seconds

</script>

chas
12-27-2006, 02:05 PM
yeah i think i have all the content....with the default CSS i see a white blank section, with the borders

And if i take out the display:none, i get the standard DIVs showing.

Any help on this please....

the other way is to scroll the div automatically....how do i scroll it per DIV.....so that a DIV content is shown for 3 sec and then scroll up/down/sideways:


EDIT2: Also why do u have contentslide twice??

.contentslide{
border: 10px solid navy;
border-bottom-width: 6px;
padding: 8px;
width: 400px;
height: 250px;
}

.contentslide .contentdiv{
display: none;
}

ddadmin
12-27-2006, 11:36 PM
Regarding .contentslide being repeated twice in the CSS, this is not true. The rule:


.contentslide .contentdiv{
display: none;
}
targets the .contentdiv selector within .contentslide, not .contentslide itself.

There must be something erroneous with the way your PHP is outputting this script that's causing you problems. DHTML scripts are such that it doesn't matter how you get the script to display, whether dynamically or by manually adding it to your page- if the final output is correct, the script will run, period. There are no issues with environments, server type, PHP versions etc.

Try viewing source on your page, and see how the slider script deviates from the original syntax that is the cause of the problem, then work backwards to correct it inside your PHP script.

chas
12-28-2006, 05:39 PM
hi thanks for helping....i looked at the html source and the data is sent to html but i am thinking the JS is not locating the data and its lost amongst the other html generated.

How can i avoid this??

jscheuer1
12-28-2006, 06:35 PM
A link to your problem page would probably help sort this out.

queerfm
12-28-2006, 08:32 PM
hi just wondering i want to know i have got this to work but is there away i can get a page like for e.g. if i click news and it bring up news can i then click a news item and it bring the story up to, with out having to reload to another page. or like a second slider. i tried making a second slider but no luck so far. can any one help.

chas
12-29-2006, 05:22 PM
hi hi, here s the link

http://illusionz.game-server.cc:11970/my_recreation/index.php?act=idx

the top category "Site News" has 3 columns that i would like in one column and rotated

chas
02-01-2007, 09:29 AM
doesn anyone know if putting a table insed the div would affect the location?

jhondoe
02-01-2007, 11:24 PM
My solution in http://jhondoe.no-ip.org (Featured Content Slider) Block center...
my cms is phpnuke...

:eek: :eek:

chas
02-02-2007, 12:23 PM
hey hey did you pull from database or predefined template??

jhondoe
02-02-2007, 01:16 PM
hey....yes database...
:eek: :eek: