define my own "tags" for quick altering site layout

define my own "tags" for quick altering site layout

am 23.09.2007 15:39:43 von stroncococcus

Hello!

I am thinking of a way to define my own tags like or {my_tag}
or something like that, and later substitute these with real html
code.

For example, lets say I have a code snippet:
{content_title}The Title{/content_title}

Before echoing it out, I would do the following substitution:
{content_title} =


{/content_title} =


This is a very simple example. But in a big site with many of the same
components, such a scheme would make sense to alter the page layout
pretty quick.
Are there some helper classes or functions, or perhaps a whole package
already for such a task?
Or should I simply create the content with my tags and then subsitute
all my tags with the real html code via preg_repalce function before
printing it out? If yes, are there any better performance options
instead of using preg_replace?

Kai

Re: define my own "tags" for quick altering site layout

am 23.09.2007 15:44:58 von Jerry Stuckle

Kai Schlamp wrote:
> Hello!
>
> I am thinking of a way to define my own tags like or {my_tag}
> or something like that, and later substitute these with real html
> code.
>
> For example, lets say I have a code snippet:
> {content_title}The Title{/content_title}
>
> Before echoing it out, I would do the following substitution:
> {content_title} =


> {/content_title} =

>
> This is a very simple example. But in a big site with many of the same
> components, such a scheme would make sense to alter the page layout
> pretty quick.
> Are there some helper classes or functions, or perhaps a whole package
> already for such a task?
> Or should I simply create the content with my tags and then subsitute
> all my tags with the real html code via preg_repalce function before
> printing it out? If yes, are there any better performance options
> instead of using preg_replace?
>
> Kai
>

Make it easy on yourself. Use CSS. That's what it's there for.

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

Re: define my own "tags" for quick altering site layout

am 23.09.2007 16:04:16 von Lars Eighner

In our last episode,
<1190554783.204395.89330@w3g2000hsg.googlegroups.com>,
the lovely and talented Kai Schlamp
broadcast on comp.lang.php:

> Hello!

> I am thinking of a way to define my own tags like or {my_tag}
> or something like that, and later substitute these with real html
> code.

> For example, lets say I have a code snippet:
> {content_title}The Title{/content_title}

> Before echoing it out, I would do the following substitution:
> {content_title} =


> {/content_title} =


Why do you want to convert it into nonsense? is not only
invalid in every version of HTML but also makes no sense whatever.

Try learning HTML first.

> This is a very simple example. But in a big site with many of the same
> components, such a scheme would make sense to alter the page layout
> pretty quick.

It seems you are trying to invent XML.

> Are there some helper classes or functions, or perhaps a whole package
> already for such a task?
> Or should I simply create the content with my tags and then subsitute
> all my tags with the real html code via preg_repalce function before
> printing it out? If yes, are there any better performance options
> instead of using preg_replace?

The most important thing is to learn HTML. If you cannot make valid pages
without PHP, you cannot make valid pages with HTML.

--
Lars Eighner
Countdown: 485 days to go.
What do you do when you're debranded?

Re: define my own "tags" for quick altering site layout

am 23.09.2007 16:32:54 von stroncococcus

> Why do you want to convert it into nonsense? is not only
> invalid in every version of HTML but also makes no sense whatever.
>
> Try learning HTML first.

Of course I meant , but that's not the point.

My problem is, that I have to integrate the same website into
different content management systems.
But those CMS's internally use completely different structures
(sometimes hardcoded) to present the data.

For example Joomla uses











for a single article title,
whereas drupal uses





So instead of rewrite every page for every specific CMS, I want to
manage it the way I stated in my first post. This way I can simply
switch to another option file, where my tags are different defined.

What do you mean by reinventing XML? Should I use something like XSLT
(not really familiar with it)? Please point me in the right direction.

Kai

Re: define my own "tags" for quick altering site layout

am 23.09.2007 18:20:08 von Andy Hassall

On Sun, 23 Sep 2007 13:39:43 -0000, Kai Schlamp wrote:

>I am thinking of a way to define my own tags like or {my_tag}
>or something like that, and later substitute these with real html
>code.
>
>For example, lets say I have a code snippet:
>{content_title}The Title{/content_title}

Looks like you want a templating system, like http://smarty.php.net , or one
of the ones on PEAR
http://pear.php.net/search.php?q=template&in=packages&x=0&y= 0

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

Re: define my own "tags" for quick altering site layout

am 23.09.2007 21:15:28 von gosha bine

Kai Schlamp wrote:
> Hello!
>
> I am thinking of a way to define my own tags like or {my_tag}
> or something like that, and later substitute these with real html
> code.
> [snip]

makrell (http://www.tagarga.com/blok/makrell) is exactly what you're
looking for.


--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok

Re: define my own "tags" for quick altering site layout

am 24.09.2007 11:52:06 von Bucky Kaufman

"Kai Schlamp" wrote in message
news:1190554783.204395.89330@w3g2000hsg.googlegroups.com...
> Hello!
>
> I am thinking of a way to define my own tags like or {my_tag}
> or something like that, and later substitute these with real html
> code.

HTML doesn't allow you to make your own tags - although it handles them
well.

It sounds like XML/XSLT is what you're looking for here.
XML, on the other hand, is almost nothing *but* user-defined tags.
XSLT is the XML-equivalent of style-sheets, and lets you specify how the
elements will be displayed.

If you do that then, from the user's perspective, it'll appear just like any
HTML page - while still being W3C-compliant.



>
> For example, lets say I have a code snippet:
> {content_title}The Title{/content_title}
>
> Before echoing it out, I would do the following substitution:
> {content_title} =


> {/content_title} =

>
> This is a very simple example. But in a big site with many of the same
> components, such a scheme would make sense to alter the page layout
> pretty quick.
> Are there some helper classes or functions, or perhaps a whole package
> already for such a task?
> Or should I simply create the content with my tags and then subsitute
> all my tags with the real html code via preg_repalce function before
> printing it out? If yes, are there any better performance options
> instead of using preg_replace?
>
> Kai
>