UK Webmaster Talk - Online Marketing - SEO


 

A question about laying out a page with php and html

This is a discussion on A question about laying out a page with php and html within the Php and MySQL forums, part of the Programming / Scripting / Coding category; Hi, I would like to be able to have the ability to lay out my php pages in anyway I ...


Go Back   UK Webmaster Talk - Online Marketing - SEO > Website Design & Development > Programming / Scripting / Coding > Php and MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Notices

Reply

 

LinkBack Thread Tools Display Modes
Old 01-03-2007, 16:54   #1 (permalink)
Newbie
 
Join Date: Mar 2007
Posts: 12
iTrader: 0 / 0%
ShaunBurden is an unknown quantity at this point
Default A question about laying out a page with php and html

Hi, I would like to be able to have the ability to lay out my php pages in anyway I like, but with just one page. I have a selection of articles in my MySQL database, and I have a php page called articles.php. Now, each article is placed on the same page, but which one depends on what the id is, e.g. aritlces.php?id=3 would bring in the article that is in row 3, and place it in the page in the layout that I've made on the html page.

I would like to know if it is possible to take this way of working, and write the code in such a way that, depending on the amount of text or size of picture, or whatever, it will lay it out differently each time, but still on aritlces.php.
This would be very helpful if I can do this, as it won't limit me to having the same layout for each article, but the layout will be different if there are two pictures, more words, a bigger/smaller picture etc. And is it possible to alter the table also using the php, basically so I can keep one page, but have each article layed out differently.

Any help would be great, thanks.
ShaunBurden is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-03-2007, 08:24   #2 (permalink)
Moderator
 
Join Date: Mar 2005
Location: Barnsley, UK
Posts: 1,001
iTrader: 0 / 0%
Wistow has a reputation beyond reputeWistow has a reputation beyond reputeWistow has a reputation beyond reputeWistow has a reputation beyond reputeWistow has a reputation beyond reputeWistow has a reputation beyond repute
Default

This is definitely possible
You would be better off using Cascading Style Sheets (CSS) though as it would mean you could edit the pages styles in an external file and keep the articles.php file clean

Kind Regards,

Craig
Wistow is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-03-2007, 08:39   #3 (permalink)
Super Moderator
 
Join Date: Mar 2005
Location: Herts, UK
Posts: 1,030
iTrader: 1 / 100%
monaghan is a jewel in the rough
Default

As Craig has suggested, save a few base CSS layouts and when you save the article in the database, also save the layout style and then use your PHP code to select which of the layout stylesheets you include.

I'd suggest having a single sheet for the base layout and the article stylesheets with identical classes but in seperate files, this way the common page styles will be cached by the browser and you only have to pull back a small amount of styling data when you select a new layout.
monaghan is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-03-2007, 11:51   #4 (permalink)
Newbie
 
Join Date: Mar 2007
Posts: 12
iTrader: 0 / 0%
ShaunBurden is an unknown quantity at this point
Default

Right, so I would use CSS to do this. I'm still learning all this stuff so I'll need to get some help. How exactly does it work, how does the php take the CSS and use it. Let's say I've written a CSS style exactly how I want it, what are the next steps I would take, like putting it in the database, having the article use that style etc.

Thanks again.
ShaunBurden is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-03-2007, 12:55   #5 (permalink)
Super Moderator
 
Join Date: Mar 2005
Location: Herts, UK
Posts: 1,030
iTrader: 1 / 100%
monaghan is a jewel in the rough
Default

Sounds like you've taken on a big project to learn on when you don't know the fundamentals of HTML & CSS

If I was you, I'd invest in some of the Sitepoint (www.sitepoint.com) CSS books and take a look through their tutorial sections while you're over there.

As I suggested, simply store the stylesheet name in the database and when you create the HTML page in your PHP code, pop this into the header as an additional stylesheet link.
monaghan is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-03-2007, 12:56   #6 (permalink)
Newbie
 
Join Date: Mar 2007
Posts: 12
iTrader: 0 / 0%
ShaunBurden is an unknown quantity at this point
Default

Ok, I've done a bit of looking around and I've got the basics of how CSS works, and I know html a good deal. I just need to work out how I'll write my CSS, but if I have any problems I'll post it.

Thanks for your help.
ShaunBurden is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
html, laying, page, php, question

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Question about links BillyB Website Design Forum 3 06-12-2006 13:42
I have a question, plz look. Arthur32 General Webmaster Discussion 0 18-08-2006 16:41
Question regarding sedo. robertall General Webmaster Discussion 2 28-07-2005 18:44
Vb question kastor Search Engine Optimisation (SEO) 1 24-05-2005 14:49
www or not www that is the question woodflooristcom Search Engine Optimisation (SEO) 1 16-02-2005 18:34


All times are GMT +1. The time now is 16:26.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
UK Webmaster Forum © WebmasterTalk.co.uk | Design by Forbairt

Ad Management by RedTyger

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41