/    Sign up×
Community /Pin to ProfileBookmark

reading files from folder to echo links to jq func

im trying to defy as much as pictures that in my gallery folder on my server
and echo it in jquery function so a gallery slider could show it.. i guess its not possiable or im doing it wrong because its not working..
i searched the web and noticed that maybe im not doing by the right order..
i need help please ?

[CODE]jQuery(function($){
$.comp({
slides : [ // Slideshow Images
<?PHP
$dirname = “./gallery/”;
$images = scandir($dirname);
foreach($images as $curimg){
echo “{image : ‘./gallery/$curimg’, title : ”, thumb : ”, url : ”},”;
};
?>
]

});
});[/CODE]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@hyperionXSMar 04.2012 — Try this
[CODE]
jQuery(function($){
$.comp({
slides : [<?PHP
$dirname = "./gallery/";
$images = scandir($dirname);
$i=0;
foreach($images as $curimg){
if($curimg!='.' and $curimg!='..'){
echo ($i?',':'')."nt{image : './gallery/$curimg', title : '', thumb : '', url : ''}";
$i++;
}
};
?>

]
});
});
[/CODE]

It outputs something like this.
[CODE]
jQuery(function($){
$.comp({
slides : [
{image : './gallery/index.htm', title : '', thumb : '', url : ''},
{image : './gallery/index.php', title : '', thumb : '', url : ''},
{image : './gallery/new.jpg', title : '', thumb : '', url : ''}
]
});
});
[/CODE]
×

Success!

Help @chryaner spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...