Scripting Template and Design Language

desmondw

New Member
Messages
4
Reaction score
0
Points
0
I'm not that familiar with any code structure past HTML and CSS and was wondering what kind of scripting and with what language I should use to have a standard template on my site (such as the same look on every page without rewriting code). CSS is looking pretty good for changing looks globally with one file to edit - but I'm concerned with the content that is static across all pages (background, main links, add placement, etc...). For a reference you can see my site at theexistential.com (still in progress obviously) and just view source - the only thing I have besides the base html currently is CSS.

Also, I'm trying to get a feel for what kind of scripting languages to use for my site (and what I need). It's hard to do this by using view source on web pages. The site will be a blog - so ideas as far as showing blog posts on a single page via references (instead of manually editting the content everytime I add a post) would be a good start.

Thanks
 

akkudreamz

New Member
Messages
183
Reaction score
0
Points
0
have you heard of smarty
google it and you'll find some tutorials its actually a template engine for php
most standard sites are built using smarty these days
as it separates the code from the presentation
 

freecrm

New Member
Messages
629
Reaction score
0
Points
0
I don't use a CMS, as I find them annoying!!

The scripts I use are in php and very useful for maintaining a corporate feel throughout the entire site.

As you know, you can use single .css files to control the look across the site.

In addition, you can also use the <?php include(); ?> function, which is great because you can put your header/ footer or any other part of a page into seperate files and insert them when you want to.

This not only cuts down replication, but makes life very simple when you want to change a look across the site.

I wonder if you can change a .css file by using php variables?? Hmm... must look into that!

The standard way to alter styling depending on a set of circumstances would be to include a different .css file link with a <?php if()....else ?> statement.

This way, you could load personal preferences for instance, which would load a specific .css file, depnding on the value the if..else statement gets.

Does this help at all??
 

desmondw

New Member
Messages
4
Reaction score
0
Points
0
In addition, you can also use the <?php include(); ?> function, which is great because you can put your header/ footer or any other part of a page into separate files and insert them when you want to.

This is exactly what I want to do. Do you (or does anyone else) have example code I could look at for a reference? I usually learn best by referencing fully written code.
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
I can't really write out a full code now, but I can give an example. Also, you can try w3schools.com/php if you are learning PHP.

This is basicly a simplified WordPress "Loop"
PHP:
<?php
include('header.php');

/*
*
*Static Data
*Like News Posts
**Etc.
*This would be directly after your navigation, which is in header.php
*
*/

include('footer.php');

?>

Header.php (Just filling in what would be there:

PHP:
<html>
<head>
<title>(Dynamic Usually)</title>
<!--Meta & Javascript Here-->
</head>
<body>
<!--Whatever your header is...-->
<!--Navigation-->

<!--Rest of the page is called from index.php-->

Note: Header.php can contain PHP, I just used HTML. :p

The index.php file would contain JUST the page. All the content, sidebars, etc. Sidebars can be included from seperate files by using divisions and include()s.

Footer.php

PHP:
<div id=footer>
Here's your footer
</div>

<!--Whatever you need to end the page...-->
</body>
</html>

Is that good? :)
 

freecrm

New Member
Messages
629
Reaction score
0
Points
0
I think thats spot on Neil!

Desmond, we can't really do full script because we don't know what files you're referencing and what you want contained in them! ;)
 
Top