Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Featured Content slider

  1. #1
    Join Date
    Aug 2006
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Featured Content slider

    1) Script Title: Featured Content Slider

    2) Script URL (on DD):
    http://dynamicdrive.com/dynamicindex...tentslider.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
    Last edited by chas; 12-23-2006 at 12:33 PM.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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.

  3. #3
    Join Date
    Aug 2006
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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
    Last edited by chas; 12-24-2006 at 04:31 AM.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Aug 2006
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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?

  6. #6
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:

    Code:
    <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:

    Code:
    <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.

  7. #7
    Join Date
    Aug 2006
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    the php page has full page formatting, heading, footer etc etc....


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

  8. #8
    Join Date
    Aug 2006
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

  9. #9
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:

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

  10. #10
    Join Date
    Aug 2006
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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;
    }
    Last edited by chas; 12-27-2006 at 02:23 PM.

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
  •