Tags with parameters

Use GitHub to post feature requests for phpwcms.
Locked
marses
Posts: 26
Joined: Wed 5. Nov 2003, 09:53
Location: Dorking, England

Tags with parameters

Post by marses »

Hi,

What I'd really like to have is a sort of "framework" function (using preg_replace or whatever) allowing to develop and use tags with parameters. Then a page could contain different instances of a tag that would produce different outputs based on tag parameters.

Syntax could look like {MYTAG:var1=int:var2=string: ... :n=zzz} - similar to typoscript's.

Say I'd like to have a "scattered" navigation menu:

{MENU:level=0:position=hor:style=1} would output
Horizontal 0 (root) level menu with predefined style #1

{MENU:level=1:position=hor:style=2} would output
Horizontal 1st level menu but different style (#2)

{MENU:level=2:position=vert:style=3} would output
Vertical 2nd level menu, again different style (#3)

I started doing it for my own purposes, wrote menus-producing functions but stopped at content.func.inc.php as I simply dont't have enough technical knowledge of how to parse and replace my tags with function using tags' parameters... :cry:

I think it would be a very useful feature.

Marius
Last edited by marses on Sat 8. Nov 2003, 20:22, edited 1 time in total.
marco

Post by marco »

The navigation is generated based on the site structure and the site structure naturally maps into lists. Lists are already widely used to create all sorts of navigations schemes and they can be easily styled and embedded pretty much everywhere.

How difficult would it be to generate alternative navigations schemes in phpwcms, similar to the alternative templates?

I did not look at the code to see how the current navigation is generated, but the end result on the page looks like a nested list (even though it is probably rendered using tables, not lists).

If the navigation code was generated as nested lists, then simply changing the CSS we would achieve different looks and types of navigations (vertical, horizontal, etc.) and we would not have to touch the phpwcms code. This would be a lot easier to style than a navigation scheme based on tables.

Plus, there is already a large collection of list-based schemes in many places, such as:

http://css.maxdesign.com.au/listamatic/index.htm

The navigation list template could be selected in the admin panel, similar to the page template, or it could be specified as a parameter like you are suggesting.

Any comments?
marses
Posts: 26
Joined: Wed 5. Nov 2003, 09:53
Location: Dorking, England

Post by marses »

I think this is a piece of code that I will use :D

Code: Select all

$search[10] = '/\{SPACER:(\d+)x(\d+)\}/';
$replace[10] = '<img src="img/leer.gif" border="0" width="$1" height="$2">';
And the idea of using nested list is good.

Marius
User avatar
Oliver Georgi
Site Admin
Posts: 9889
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

That's what I want to build next: a replacement tag that return a <ul><li></li></ul> styled list based on site structure. It will include special id-attribute so that you can create #css_name to get CSS styled menues like this here http://www.alistapart.com/articles/taminglists/.

And I also want to develop some addintional menu functions that represents only the given structure level (as you described).

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
marses
Posts: 26
Joined: Wed 5. Nov 2003, 09:53
Location: Dorking, England

Post by marses »

It would be nice if the function returned:
  • * all levels
    * a given level
    * a givel level and bellow
    * a range of levels
marco

Post by marco »

ALA just published this article on using PHP with list-based
menus; I thought it might be relevant to this discussion,

http://www.alistapart.com/articles/keepingcurrent/
User avatar
Oliver Georgi
Site Admin
Posts: 9889
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

That's exact on what I'm working ;-)

But it is a bit more difficult than it sounds like. The problem is that phpwcms supports unlimited nested levels. But I will prepare different listing results. It needs some days I think because I have no time at the moment to work non-stop on that.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
marco

Post by marco »

Not a problem, take your time; you've done a terrific job already and with the documentation.

In terms of the unlimited levels, it seems that, personally at least, I would not want to have a menu that goes beyond two or 3 levels, at most. I would organize the content so that the structure is not deeper than three levels anyway. Few sites, even link directories, seem to nest more than 3 levels deep.

The other thing is that menus with more than 3 levels are not vey appealing.
But you probably need the unlimited nestng for other things.
Locked