FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


CSS/Layout Help Please!





simplyw00x
My new website has a pretty funky CSS layout (unfortunately it doesn't look absolutely right in the latest beta of Firefox, and if you're using IE, don't even bother).

My problem, however, is this. If you open any of the articles, you'll see an 'add comments' section, which (unless you're using the ridiculous high resolution I used to design the website) will look pretty shocking. How can I dynamically resize the textarea to be a percentage of the window width? How can I keep the help section next to the exntry form, and prevent it slipping below? How can align the two textbox entry fields to the right edge of the entry form?

Also, how can I make it easier for users to switch stylesheets? I have 2 'alternate stylesheets' defined (that can be changed in Firefox), but they don't hold across pages and it isn't all that easy to find the option to change them. Any ideas?

Any help appreciated, thanks.
davmcmul
well, for most of that i wouldn't have a clue but i just so happen to know of one relatively easy way of doing the stylesheet option, i was doing something similar a while ago and i found the easiest way was to have a php switcher page, i could explain it but i think it's done much better here, ok, my mistake, i can't find the site with the nice concise tutorial, you could search for "php switcher" and have a look at any one of those tutorials, or you could try and manage with my explanation:

since, php cookies can only be set at the start of a document, they have to be set before any html code. So the easiest way of doing this is having a number of small links (or you could do it with a html form done like a drop-down list, matter of preference really.) which go to your php switcher page, lets call it switcher.php and this is the code for that page:

Code:
<?php
setcookie ('sitestyle', $set, time()+31536000,
   '/', 'yourdomain.com', '0');
header("Location: $HTTP_REFERER");
?>


and then in your links which change the style, you have this code:

Code:
<a href="./switcher.php?set=red">
red style</a>


and your link to the stylesheet is like this:

Code:
<link rel="stylesheet" type="text/css"
   media="screen" title="User
Defined Style" href="<?php echo
(!$sitestyle)?'blue':$sitestyle ?>.css" />


assuming that you want blue.css to be your default and that red.css is another one of your styles. ie, when the cookie is not set for whatever reason, it automatically chooses blue.

. for all the other stuff i really can't help you.
simplyw00x
THanks for that; I assume this'd work with sessions as well?
davmcmul
i'm almost positive it would work, except there's no longer any need for the switcher page, you just have to set the sessions at the start. and you can change it anywhere around the document. but i would advise against using sessions, i did use them for the smae purpose and i switched to cookies for two reasons:

1 sessions are impermenant, the user would have to choose the style again everytime he went to your site (unless you have a login system, which would be beyond my ken for helping you)

2 sessions add long nasty strings of letters/numbers to the url which means your page no longer validates as html.

just my oppinion, i am by no means an expert.
simplyw00x
Thanks, davmcmul.

Everyone else: bump
Related topics
Reply to topic    Frihost Forum Index -> Webmaster and Internet -> Design Tips

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.