Jump to content

Php in Javascript


divinedesigns1
 Share

Recommended Posts

hello, this came across my mind, since i was looking up how to make a rotating gallery "which i found", so now im thinking can i make the images be uploaded into the javascript by added the php tags like how you do it in the html form "if you dont get it see below

<!-- not gonna write the whole script out --><form action="#" method="post" value="#"><input type="email" name="email" id="email" value="<?php echo $email; ?>" /></form>

but then and in the php i would have to make the items go by item number "since the javascript i found is using a item variable to display different image and text, etc :Pleased: this would work right? or do i need an extra step?

Link to comment
Share on other sites

I'm not really sure what you're asking. You could try presenting your question a different way? And just to be clear, PHP executes before any other output, (HTML/CSS/JS) to the browser, so typically if you want to mix the two, the PHP generates the needed output, and in this process, you can have dynamic content generated on the server side before it gets to the browser.

Link to comment
Share on other sites

yea i know about the php needed to be excuted before any other thing, but what i was trying to fine out is that if i have a javascript doing a rotation of images in a gallery on a page, and i would like to add more images to that gallery. If i can use php to do and let the php display the images in the javascript variable as it in the javascript like the javascript variable for the images are items[0], etc and i make the php to upload the images in a variable which goes from item[0] to item[w.e] which allowing the javascript to rotate those images without doing it manually is that possible?

Link to comment
Share on other sites

from what it sounds like, yes you could have Javascript make an AJAX request to return more content from the server, in the form of image URL's or whatever, and have Javascript append them or cycle through them within the context of your gallery.

Link to comment
Share on other sites

from what it sounds like, yes you could have Javascript make an AJAX request to return more content from the server, in the form of image URL's or whatever, and have Javascript append them or cycle through them within the context of your gallery.
i though i needed another extra language, thank a lot thesci
You could get php to search a specific image folder, and place all listed images within that folder in a javascript array to show in a gallery.
ok ill try this one, then but i need to learn these languages first, im still on php since i end up with a lot of work thank a lot guys
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...