modify css content with php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ivan_nn2
Forum Newbie
Posts: 5
Joined: Fri Apr 23, 2010 5:50 am

modify css content with php

Post 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.
User avatar
F00Baron
Forum Newbie
Posts: 6
Joined: Sat Feb 20, 2010 11:43 am

Re: modify css content with php

Post 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
ivan_nn2
Forum Newbie
Posts: 5
Joined: Fri Apr 23, 2010 5:50 am

Re: modify css content with php

Post 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
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: modify css content with php

Post 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.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
ivan_nn2
Forum Newbie
Posts: 5
Joined: Fri Apr 23, 2010 5:50 am

Re: modify css content with php

Post 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
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: modify css content with php

Post 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.
ivan_nn2
Forum Newbie
Posts: 5
Joined: Fri Apr 23, 2010 5:50 am

Re: modify css content with php

Post by ivan_nn2 »

Thanks,
i did it, after some days.... even if it's not perfect...

thatnks, again :)
Post Reply