PDA

View Full Version : how do i stop repeating loads of code


genesis
04-18-2008, 02:13 AM
hi how do i stop repeating loads of code
when creating a website in cs3 i seem to be copying and pasting code
to all of my pages eg like the menu
how is this done im sure this only needs to be done once when done
right
hope i have explained correctly

tony

edbr
04-18-2008, 03:02 AM
by using templates or includes if php you coulds also save code snippets and a double click would insert them into your page

Corrosive
04-18-2008, 07:09 AM
hi how do i stop repeating loads of code
when creating a website in cs3 i seem to be copying and pasting code
to all of my pages eg like the menu
how is this done im sure this only needs to be done once when done
right
hope i have explained correctly

tony

Hi Tony

Are you building the main and constant elements your site in external style sheets and then linking them in to each page? I.e. If your background image, menus and banners remain constant throughout your site then you should create a style sheet with perhaps the name 'mainlayout.css' and link every page into this meaning that code is not repeated for every page but created once and then each fresh page uses these styles as the blocks to build other elements on to.

I use 'mainlayout.css' for menus and the background and then perhaps 'homelayout.css' for the elements which are specific to my home page. This means that content and style are seperate. If I then decide to have a change i.e. a different bakcground image, I change this once in the 'mainlayout.css' and it is updated through the whole site.

Is this what you mean?

genesis
04-21-2008, 12:32 PM
Yes Corrosive im learning about that now like using a external css file so all the pages are updated at the same time
Thankyou

Corrosive
04-21-2008, 04:55 PM
Hi Tony. Glad to be of some small assistance. Good luck with learning css. It's hard but worth it in the long run. I have started a tutorial on my site for learning basic css and it may help you. Click on to...

http://www.corrosiveonline.co.uk/webstuff.htm

...select Dreamweaver from the side menu and look for the tutorials. There are three parts at the moment (there will be 5 in total).

Cheers :wink:

genesis
04-23-2008, 04:52 AM
Thanks again
yep css is easy when you know how lol
tony