Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Foren / Cotonti / Core Labs / Archive / Proposed TITLE / META generation

#1 3. August 2008, 21:24
------------------------ TITLES -----------------------------------

This is the proposed generation of titles. All the proposed values would be defaults in your installation and you would be able to change each via a config like this:

"{PAGETITLE} -=- {PAGECAT} -=- {SITENAME}" (without quotes)

Basically you could reorder them how you would want, but the defaults would be the best SEO wise. This is based on the idea that the user coming from the search engines is not looking for you but for what you have to offer on the site (if he was searching for you he would have typed in your domain name).




<custom text> {CATEGORY}, {PAGE} | {SITENAME}

(example: "Best recipes for {CATEGORY}, Download drivers for {CATEGORY}")




You would be able to input a list of URLs into a textarea and custom titles for them. Example:

hxxp://,Use this form to send us an email

It would then use this title on the URL chosen.

------------------------ METAS -----------------------------------


Metas are generated from the description field, if it's empty it takes the first 250 characters from page text, does a sed_cc and strip_tags on it.


Taken from category description, if it's empty create a configable sentence eg. "Interesting pages about {CATEGORY} like {PAGE1} and {PAGE2}"


Taken from first post, the first 250 characters, cleaned up


Taken from description, if not create a configable sentence eg. "Interesting discussions about {SECTION} like {TOPIC1} and {TOPIC2}"


Configable description


Ideas welcome.
<a href="">Surreal Art</a>
#2 3. September 2008, 22:01
It seems that we can use sed_outputfilters() to modify <title> and <metas> at the end of parsing.

I mean, this should be in core, so each plugin can add to it its own title/metas format.
We can use $location and $z global variables as a KEY

(NOTE: I will discuss this later in Ideas section, where Id like to propose a new plugins feature that will allow for multiple "standalone" pages within one plugin, which makes $location & $z no longer sufficient, so the easiest workaround is to make $location an array instead)

As a "text source" we could use similar "variable mapping system" to this known from XTemplate class, ie:

{PHP.page_title} => replacement defined in PHP as $page_title
{} => replacement defined in PHP as $array['page']
Perl - the only language that looks the same before and after RSA encryption.
#3 3. September 2008, 23:58
The problem with ob_start handlers is that it overrides as you go. Meaning that overwrite function should be registered before you send a string to output buffer. So if metas were sent to the buffer in header, you cannot override it in plugin without copying buffer contents, smashing it and sending to output again (which is a waste).
May the Source be with you!