Page 1 of 1

modify css content with php

Posted: Fri Apr 23, 2010 5:59 am
by ivan_nn2
Hello everybody,...

I'm new using php, and i have a problem that i don't know how to solve, also because i don't even know what to look for in internet...

Basically i started few time ago css , javascript and php and now i have a little bit mess in my head.. :)

So the problem is this one:

I have a page with a body, a wrapper in the center and a rectangular content inside the wrapper (all made with css)..

Inside this content i should put a dropdown list menu (tools, toys, clothes..etc...).

I wanted to make possible that when someone makes a choice on the dropdown, immeadetly a table is created under the dropdown menu (inside the content) and on each cell of the table there should be an image taken from a database...

I have quite in mind how to dinamically create a table basing on the numbe rof images of the recordset, that maybe it's not a problem (maybe :) )..

My real question is:
is it possible to modify the inside of a css section on the base of a choice of a dropdown list in that section, without reloading a page and without calling another php page where to make the db query?...
Or if it's necessary to call another page where to make the query, how can i then return to the previous page?.. (this sounds stupid but i'm really a newbe)

I don't know if i wasn't clear,...

I'm looking for a resolution, or a path to follow....

thanks, I.

Re: modify css content with php

Posted: Fri Apr 23, 2010 8:45 am
by F00Baron
Have a look at jquery it's simple to use and very powerful. It will let you modify any of the css on the page.
http://docs.jquery.com/Main_Page

Re: modify css content with php

Posted: Fri Apr 23, 2010 11:24 am
by ivan_nn2
Before i'll dive in this jquery system, .... is it the only way to do this?...รน

just to know... because i have to finish this thing, really really quickly... not my fault :)

thanks

Re: modify css content with php

Posted: Sat Apr 24, 2010 8:34 am
by social_experiment
You could probably achieve it using javascript & ajax. When do you want the (new) styling to be applied? Immediately after the new style option has been selected or when a new page is visited (from your post Im assuming the first option)? I dont know when the browser would apply newly modified css, because i think the css is only loaded once the page is refreshed.

Re: modify css content with php

Posted: Mon Apr 26, 2010 5:53 am
by ivan_nn2
Wow...

I did it.. hey thanks to evrybody...

now it does exactly what i expected...

The only thing is that i went to the JQuery site, and i followed the example and write

<script src="http://code.jquery.com/jquery-latest.js">
function showClothes()
{
$("contentbrand_inside").empty().remove();
);
</script> ..


but it doesn't work....
Ok i mean i found another system with javascipt to remove a div but i was curious about that code... it should work...

Anyway do you know if with Javasciript is it possible to call a div that you have in the css file and attach to a parent div?...

thanks

Re: modify css content with php

Posted: Mon Apr 26, 2010 12:23 pm
by Jonah Bron
Put a <div> inside your content where you want the table to appear. Make it empty, and give it an ID, like "table_zone". Have a separate PHP file that outputs all the necessary HTML for the table you want. Call that page with AJAX (use jQuery or Mootools if you like), and put the response into the div "table_zone". If you need help with the PHP to write the table, say so.

Re: modify css content with php

Posted: Mon May 03, 2010 4:48 am
by ivan_nn2
Thanks,
i did it, after some days.... even if it's not perfect...

thatnks, again :)