Reply to Re: selecting specific tag

Your name:

Reply:


Posted by Jerry Stuckle on 04/04/06 23:02

Stephen Kay wrote:
> in article RuSdnfIbrcxVSqzZnZ2dnUVZ_s2dnZ2d@comcast.com, Jerry Stuckle at
> jstucklex@attglobal.net wrote on 4/3/06 11:19 PM:
>
>
>>
>>But if I *had* to do this (kicking and screaming) I'd go ahead and delete the
>>tags from the files.
>
>
> I would say that using templates and reading material into content variables
> is a pretty standard way of doing things with php. Almost all of the
> php-based forums use this method. The advantages are that you can completely
> change the layout and appearance of all the pages
>

Yes, it is.

> If you have a template, you can have a table on the page, with a $navbar
> variable, $header, $footer, and $content variables (maybe several of them),
> all positioned inside different cells of the table and display all of the
> pages of the site in that template. If you suddenly decide you'd like the
> navbar on the other side of the page, or the bottom, or to make the page
> background a different color or image, you just change to a different master
> template.
>

That's one way to do it.

> With the method you are talking about, it seems you would have to change
> each page to completely change the layout. Maybe I don't know that much
> about it, but I think you are using each page to do the main formatting, and
> then just including a header, footer, etc.? The positioning of those
> elements is determined by each page, and where the includes are located.
> Whereas the positioning of the elements is determined by the template in the
> way I'm doing it.
>

Nope. The page itself contains only information specific to that page, i.e.

<!DOCTYPE ...>
<html>
<head>
<title>...</title>
<meta...>
<?php include('header file location')

The header file contains common header elements, the </HEAD> and <BODY> tags
plus the rest of the header.


Next comes the page-specific content

This is followed by an include for the footer - which finishes the document.

So - formatting for every page can be changed by simply changing the
header/footer page.


> My problem is that I'm trying to adapt an existing straight HTML site to
> this other method. Normally, if creating this method from scratch, you
> wouldn't put headers, and HTML and BODY tags in the parts that are intended
> for content.
>

See above.

> Anyway, I now have some code that strips off the header, and removes the
> HTML and BODY tags (thanks to all for the suggestions etc.). I realize this
> would not be robust for a general solution, but I'm only applying it to one
> existing site that has no fancy stuff like nested comments inside the tags
> etc.
>

OK, but it sounds like a recipe for disaster to me. You don't have any of that
now - but what about the next guy who comes along and has to maintain the site?
Or even you six months from now?

Personally I'd rather do it right than do it over.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация