PDA

View Full Version : (PHP) Template changes



Dark Steno
03-03-2006, 08:39 AM
I am abit busy nowadays and I want to make some changes to my website. I want to make several buttons that can change the website template/skin/whatever without really refreshing the page by clicking on them. Each one represents different template/skin. I've seen something like Joomla CMS but the source code is too advanced for me to decipher.

:) Anyone can help me?

tesco
03-03-2006, 08:42 PM
If you just want to change CSS you can easily use 'ajax' to do it without refreshing the page.
Is that what you want?

SeK612
03-03-2006, 09:56 PM
Is ajax easy to learn?

Dark Steno
03-04-2006, 10:20 AM
Apart from CSS, it may even change bakcground pics and so on. :) Ajax can do it? Let me look at it.

SeK612
03-04-2006, 11:01 PM
Well Ajax seems pretty comprehensive so I guess it would (it's what's used when you click to edit a post on the forum and by companies like Google, where you can drag stuff freely around the page).

tesco
03-05-2006, 01:44 AM
Well Ajax seems pretty comprehensive so I guess it would (it's what's used when you click to edit a post on the forum and by companies like Google, where you can drag stuff freely around the page).
Dragging stuff around isn't ajax, you're right about the quick edit and quick post tho.
Ajax is loading stuff from the server to the page without it actually reloading the page (does it in the background).

Now that I think about it you can probably do this without even using ajax.

Just a javascript function like:


<script type="text/javascript">
function changeCSS(cssname)
{
if (cssname=='style1')
{
document.getElementById('pagecss').value = 'the css goes here, not including <style></style> tags. ex: h1{ font-weight:bold; }';
}
else if (cssname=='style2')
{
document.getElementById('pagecss').value = 'the css goes here, not including <style></style> tags. ex: h1{ font-weight:bold; }';
}
}
</script>

On a page like:


<html>
<head>
<style id="pagecss" type="text/css">
default style goes here :/
</style>
</head>
<body>
<a href="#" onclick="changeCSS('style1');">Change to style 1</a>
<a href="#" onclick="changeCSS('style2');">Change to style 2</a>
</body>
</html>

SeK612
03-05-2006, 11:34 AM
Aren't pages where you can drag stuff around (like the customisable part of Google news and Google Personal (http://www.google.com/ig)) as you drag stuff on the page without it reloading.

tesco
03-05-2006, 06:08 PM
Aren't pages where you can drag stuff around (like the customisable part of Google news and Google Personal (http://www.google.com/ig)) as you drag stuff on the page without it reloading.
Nope that's just another part of javascript.
To be considered 'ajax' I'm sure it has to actually be sending and/or receiving from the server without the page reloading.;)