Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi ihave a code that came from this link

the problem is i cannot set the while loop inside the json because i don't have an i dea on how to here's my whole code


XML
<!doctype html>
<html lang="en" >
<head>
    <meta charset="UTF-8">
    <title>Agile Carousel Multiple Slides Visible example</title>
    <meta name="description" content="Agile Carousel javascript jquery image gallery">
    <meta name="keywords"    content="Agile Carousel javascript jquery image gallery">



<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.js"></script>
<link rel="stylesheet" href="agile_carousel.css">
<script src="agile_carousel.alpha.js"></script>

<script>

    $.getJSON("agile_carousel_data.php", function (data) {

        $("#multiple_slides_visible").agile_carousel({
            carousel_data: data,
            carousel_outer_height: 230,
            carousel_height      : 200,
            slide_height         : 200,
            carousel_outer_width : 480,
            slide_width          : 260,
            number_slides_visible: 3,
            transition_time      : 330,
            control_set_1: "previous_button,next_button",
            control_set_2: "group_numbered_buttons",
            persistent_content: "<p class='persistent_content'>Agile Carousel Example: Multiple Slides Visible</p>"
        });

    })

 </script>

</head>
<body>

    <a href="http://krablekod.ru" > home</a>
    <br />
    <a href="../index.html" > back </a>
    <br />
    <a href="http://demo1.krablekod.ru/files/archives/agile_carousel_examples.tar" > Agile Carousel examples example </a>

    <div class="slideshow_wrapper">
        <div class="slideshow_title">Multiple Slides Visible</div>
        <div class="slideshow_wrapper slideshow_wrapper_right">
            <div class="slideshow" id="multiple_slides_visible"></div>
            <div class="slideshow_description">
                <ul class="slideshow_features">
                    <li>3 Slides Visible</li>
                    <li>Circle Buttons</li>
                </ul>
            </div>
        </div>
    </div>

</body>



and here's my code for the data for agile_carousel_data.php


XML
[
            {
                  "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='banner_bike.jpg' alt='Bike'></a><a class='caption' href='#'>Sample Carousel Pic Goes Here And The Best Part is that...</a></div>",
                  "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place Holder</p>"
            },
            {
                  "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='banner_paint.jpg' alt='Paint'></a><a class='caption' href='#'>Sample Carousel Pic Goes Here And The Best Part is that...</a></div>",
                  "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place Holder</p>"
            },
            {
                  "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='banner_bike.jpg' alt='Bike'></a><a class='caption' href='#'>Sample Carousel Pic Goes Here And The Best Part is that...</a></div>",
                  "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place Holder</p>"
            },
            {
                  "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='banner_paint.jpg' alt='Paint'></a><a class='caption' href='#'>Sample Carousel Pic Goes Here And The Best Part is that...</a></div>",
                  "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place Holder</p>"
            },
            {
                  "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='banner_bike.jpg' alt='Bike'></a><a class='caption' href='#'>Sample Carousel Pic Goes Here And The Best Part is that...</a></div>",
                  "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place Holder</p>"
            },
            {
                  "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='banner_paint.jpg' alt='Paint'></a><a class='caption' href='#'>Sample Carousel Pic Goes Here And The Best Part is that...</a></div>",
                  "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place Holder</p>"
            },
            {
                  "content": "<div class='slide_inner'><a class='photo_link' href='#'><img class='photo' src='banner_tunnel.jpg' alt='Tunnel'></a><a class='caption' href='#'>Sample Carousel Pic Goes Here And The Best Part is that...</a></div>",
                  "content_button": "<div class='thumb'><img src='f2_thumb.jpg' alt='bike is nice'></div><p>Agile Carousel Place Holder</p>"
            }
            ]



and here's my while loop the original adatabase

PHP
<?php
include_once('includes/dbConnect.php');
?>

<?php
$query=mysql_query("select * from persons order by rand()");


$data = array();
while ($test = mysql_fetcharray($query)){

PHP
<?php
include_once('includes/dbConnect.php');
?>


$query=mysql_query("select * from persons order by rand()");

<img height=200 width=200 src='upload/". $test['Image'] ."'/> //for the image
".$test['LastName'].", ". $test['FirstName']." ". $test['MiddleName']." // for the contents

my code is working but how to convert it to json? so that the other script can get this? how can i make this json?
Posted
Updated 2-Aug-13 23:51pm
v2
Comments
Mohibur Rashid 5-Aug-13 2:31am    
did you try json_encode function ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900