Revision history for SmartTitle


Revision [23308]

Last edited on 2016-05-20 07:38:47 by JavaWoman [Replaces old-style internal links with new pipe-split links.]
Additions:
Even though the ""AddSpaces()"" option might partially help, here's a quick and dirty way I figured out to produce smarter titles (you can see a working version of this action [[http://www.openformats.org/it | here]]).
<<If your wiki supports [[HandlingUTF8 | UTF-8]], you can have beautiful **titles encoded in different languages**: just click one of the links listed on [[http://www.openformats.org/TestUTF8 | this page]]<<
Even though the ""AddSpaces()"" option might partially help, here's a quick and dirty way I figured out to produce smarter titles (you can see a working version of this action ""[[http://www.openformats.org/it | here]]"").
Deletions:
Even though the ""AddSpaces()"" option might partially help, here's a quick and dirty way I figured out to produce smarter titles (you can see a working version of this action [[http://www.openformats.org/it here]]).
<<If your wiki supports [[HandlingUTF8 UTF-8]], you can have beautiful **titles encoded in different languages**: just click one of the links listed on [[http://www.openformats.org/TestUTF8 this page]]<<
Even though the ""AddSpaces()"" option might partially help, here's a quick and dirty way I figured out to produce smarter titles (you can see a working version of this action ""[[http://www.openformats.org/it here]]"").


Revision [19435]

Edited on 2008-01-28 00:16:01 by JavaWoman [Modified links pointing to docs server]

No Differences

Revision [17824]

Edited on 2007-12-12 12:18:26 by JavaWoman [prevent function references looking as page links]
Additions:
Even though the ""AddSpaces()"" option might partially help, here's a quick and dirty way I figured out to produce smarter titles (you can see a working version of this action [[http://www.openformats.org/it here]]).
By default, page titles in Wikka correspond to their ""WikiName"".
Although this is consistent with Wiki philosophy, in some cases having a dumb ""WikiName"" as a title is pretty limiting:
~-""WikiNames"" make ""**VeryLongTitlesQuiteDifficultToUnderstand**"";
Even though the ""AddSpaces()"" option might partially help, here's a quick and dirty way I figured out to produce smarter titles (you can see a working version of this action ""[[http://www.openformats.org/it here]]"").
Deletions:
Even though the AddSpace option might partially help, here's a quick and dirty way I figured out to produce smarter titles (you can see a working version of this action [[http://www.openformats.org/it here]]).
~-WikiNames make **VeryLongTitlesQuiteDifficultToUnderstand**;
Even though the AddSpace option might partially help, here's a quick and dirty way I figured out to produce smarter titles (you can see a working version of this action [[http://www.openformats.org/it here]]).


Revision [17013]

Edited on 2007-05-31 23:27:41 by NilsLindenberg [Reverted]
Additions:
++I replaced the code with DreckFehler 's patch (see below)++
for ($i = 2; $i <= 5; $i++) {
ups! sorry, i haven't tested the small tweak. it actually didn't much more than the version before. i only changed the pattern [ \t\n\r]+ to \s+ which is virtually the same.
for ($i = 2; $i <= 5; $i++) {
if (ereg( "(=){".$i."}([^=]+)(=){".$i."}", $pagecontent, $title)) {
Deletions:
I replaced the code with DreckFehler 's patch (see below)
for ($i = 2; $i <= 5; $i ) {
ups! sorry, i haven't tested the small tweak. it actually didn't much more than the version before. i only changed the pattern [ \t\n\r] to \s which is virtually the same.
for ($i = 2; $i <= 5; $i ) {
if (ereg( "(=){".$i."}([^=] )(=){".$i."}", $pagecontent, $title)) {


Revision [16812]

Edited on 2007-05-31 10:50:09 by ShnM4e [Reverted]
Additions:
I replaced the code with DreckFehler 's patch (see below)
for ($i = 2; $i <= 5; $i ) {
ups! sorry, i haven't tested the small tweak. it actually didn't much more than the version before. i only changed the pattern [ \t\n\r] to \s which is virtually the same.
for ($i = 2; $i <= 5; $i ) {
if (ereg( "(=){".$i."}([^=] )(=){".$i."}", $pagecontent, $title)) {
Deletions:
++I replaced the code with DreckFehler 's patch (see below)++
for ($i = 2; $i <= 5; $i++) {
ups! sorry, i haven't tested the small tweak. it actually didn't much more than the version before. i only changed the pattern [ \t\n\r]+ to \s+ which is virtually the same.
for ($i = 2; $i <= 5; $i++) {
if (ereg( "(=){".$i."}([^=]+)(=){".$i."}", $pagecontent, $title)) {


Revision [7378]

Edited on 2005-04-18 15:00:08 by NilsLindenberg [added version-number]
Additions:
>>This is the development-page for smart-titles. It is integrated in Wikka since version 1.1.5.1. To see how it works, take a look at SmartTitlesInfo.>>
Deletions:
>>This is the development-page for smart-titles. It is integrated in Wikka since version X. To see how it works, take a look at SmartTitlesInfo.>>


Revision [7373]

Edited on 2005-04-18 14:30:16 by NilsLindenberg [link to SmartTitlesInfo]
Additions:
=====How to get smarter titles=====

>>This is the development-page for smart-titles. It is integrated in Wikka since version X. To see how it works, take a look at SmartTitlesInfo.>>

By default, page titles in Wikka correspond to their WikiName.
Although this is consistent with Wiki philosophy, in some cases having a dumb WikiName as a title is pretty limiting:
~-[[WikiName]]s make **""VeryLongTitlesQuiteDifficultToUnderstand""**;
~-They are not an optimal solution for visibility in search engines;
~-They cannot contain accents or other special characters;

Even though the AddSpace option might partially help, here's a quick and dirty way I figured out to produce smarter titles (you can see a working version of this action [[http://www.openformats.org/it here]]).

This action adds to the title the highest-level header available in the page (in this case ##""=====How to get smarter titles=====
""##). If no such header is found, then the standard WikiName is displayed.

<<If your wiki supports [[HandlingUTF8 UTF-8]], you can have beautiful **titles encoded in different languages**: just click one of the links listed on [[http://www.openformats.org/TestUTF8 this page]]<<

---

Here's the code to add
++I replaced the code with DreckFehler 's patch (see below)++
''*sigh*, DreckFehler always gets the credit for my code.... :) - JsnX''
''Oops - my humblest apologies :) - DarTar''
''no, no, no! i could read that sentence again and again ;))) --DreckFehler''

%%
function PageTitle() {
$pagecontent = $this->page["body"];
for ($i = 2; $i <= 5; $i++) {
if (ereg( "(=){".$i."}([A-Za-z0-9 ]*)(=){".$i."}", $pagecontent, $title)) {
$title = str_replace("\"\"", "", $title[2]);
}
}
if ($title) return $title;
else return $this->GetPageTag();
}
%%

Then make the following change in ##actions/header.php##

old:

%%(php) <title><?php echo $this->AddSpaces($this->GetWakkaName())." : ".$this->AddSpaces($this->GetPageTag()); ?></title>%%

new:

%%(php) <title><?php echo $this->AddSpaces($this->GetWakkaName())." : ".$this->PageTitle(); ?></title>%%

Comments and improvements are welcome

-- DarTar

----

Hi DarTar, thanks for sharing this improvement.

Your original code didn't give the expected results. It was grabbing **everything** between the first set of ""====="" and the last set. Even the revised fix code seemed to do the same thing. For example on this page, here's what it would return:
''<title>Wikka : How to get smarter titles""=====""

By default, page titles in Wikka correspond to their WikiName.
Although this is consistent with Wiki philosophy, in some cases having a dumb WikiName as a title is pretty limiting:
~-WikiNames make **VeryLongTitlesQuiteDifficultToUnderstand**;
~-They are not an optimal solution for visibility in search engines;
~-They cannot contain accents or other special characters;

Even though the AddSpace option might partially help, here's a quick and dirty way I figured out to produce smarter titles (you can see a working version of this action [[http://www.openformats.org/it here]]).

This action adds to the title the highest-level header available in the page (in this case ##""=====""How to get smarter titles</title>''
##
DreckFehler: your modification wouldn't seem to work at all. It just kept showing the normal wikiword page title.
ups! sorry, i haven't tested the small tweak. it actually didn't much more than the version before. i only changed the pattern [ \t\n\r]+ to \s+ which is virtually the same.
anyway, try the following to get a bit closer to the intended behaviour --DreckFehler

Below is the regular expression that I came up. It's working, but I'm sure there's room for improvement.

%%(php)<?
function PageTitle() {
$pagecontent = $this->page["body"];
for ($i = 2; $i <= 5; $i++) {
// if (ereg( "(=){".$i."}([A-Za-z0-9 ]*)(=){".$i."}", $pagecontent, $title)) {
if (ereg( "(=){".$i."}([^=]+)(=){".$i."}", $pagecontent, $title)) {

$title = str_replace("\"\"", "", $title[2]);
}
}
if ($title) return $title;
else return $this->GetPageTag();
}
Deletions:
=====How to get smarter titles=====

By default, page titles in Wikka correspond to their WikiName.
Although this is consistent with Wiki philosophy, in some cases having a dumb WikiName as a title is pretty limiting:
~-[[WikiName]]s make **""VeryLongTitlesQuiteDifficultToUnderstand""**;
~-They are not an optimal solution for visibility in search engines;
~-They cannot contain accents or other special characters;

Even though the AddSpace option might partially help, here's a quick and dirty way I figured out to produce smarter titles (you can see a working version of this action [[http://www.openformats.org/it here]]).

This action adds to the title the highest-level header available in the page (in this case ##""=====How to get smarter titles=====
""##). If no such header is found, then the standard WikiName is displayed.

<<If your wiki supports [[HandlingUTF8 UTF-8]], you can have beautiful **titles encoded in different languages**: just click one of the links listed on [[http://www.openformats.org/TestUTF8 this page]]<<

---

Here's the code to add
++I replaced the code with DreckFehler 's patch (see below)++
''*sigh*, DreckFehler always gets the credit for my code.... :) - JsnX''
''Oops - my humblest apologies :) - DarTar''
''no, no, no! i could read that sentence again and again ;))) --DreckFehler''

%%
function PageTitle() {
$pagecontent = $this->page["body"];
for ($i = 2; $i <= 5; $i++) {
if (ereg( "(=){".$i."}([A-Za-z0-9 ]*)(=){".$i."}", $pagecontent, $title)) {
$title = str_replace("\"\"", "", $title[2]);
}
}
if ($title) return $title;
else return $this->GetPageTag();
}
%%

Then make the following change in ##actions/header.php##

old:

%%(php) <title><?php echo $this->AddSpaces($this->GetWakkaName())." : ".$this->AddSpaces($this->GetPageTag()); ?></title>%%

new:

%%(php) <title><?php echo $this->AddSpaces($this->GetWakkaName())." : ".$this->PageTitle(); ?></title>%%

Comments and improvements are welcome

-- DarTar

----

Hi DarTar, thanks for sharing this improvement.

Your original code didn't give the expected results. It was grabbing **everything** between the first set of ""====="" and the last set. Even the revised fix code seemed to do the same thing. For example on this page, here's what it would return:
''<title>Wikka : How to get smarter titles""=====""

By default, page titles in Wikka correspond to their WikiName.
Although this is consistent with Wiki philosophy, in some cases having a dumb WikiName as a title is pretty limiting:
~-WikiNames make **VeryLongTitlesQuiteDifficultToUnderstand**;
~-They are not an optimal solution for visibility in search engines;
~-They cannot contain accents or other special characters;

Even though the AddSpace option might partially help, here's a quick and dirty way I figured out to produce smarter titles (you can see a working version of this action [[http://www.openformats.org/it here]]).

This action adds to the title the highest-level header available in the page (in this case ##""=====""How to get smarter titles</title>''
##
DreckFehler: your modification wouldn't seem to work at all. It just kept showing the normal wikiword page title.
ups! sorry, i haven't tested the small tweak. it actually didn't much more than the version before. i only changed the pattern [ \t\n\r]+ to \s+ which is virtually the same.
anyway, try the following to get a bit closer to the intended behaviour --DreckFehler

Below is the regular expression that I came up. It's working, but I'm sure there's room for improvement.

%%(php)<?
function PageTitle() {
$pagecontent = $this->page["body"];
for ($i = 2; $i <= 5; $i++) {
// if (ereg( "(=){".$i."}([A-Za-z0-9 ]*)(=){".$i."}", $pagecontent, $title)) {
if (ereg( "(=){".$i."}([^=]+)(=){".$i."}", $pagecontent, $title)) {

$title = str_replace("\"\"", "", $title[2]);
}
}
if ($title) return $title;
else return $this->GetPageTag();
}


Revision [3344]

Edited on 2004-12-17 10:35:05 by JavaWoman [minor edit (return to normal font after quote)]
Additions:
##


Revision [3343]

Edited on 2004-12-17 10:26:51 by JavaWoman [minor edit]
Additions:
~-[[WikiName]]s make **""VeryLongTitlesQuiteDifficultToUnderstand""**;
Deletions:
~-WikiNames make **""VeryLongTitlesQuiteDifficultToUnderstand""**;


Revision [1161]

Edited on 2004-09-09 13:48:11 by DreckFehler [everyone begrudges my merits ;)]
Additions:
''no, no, no! i could read that sentence again and again ;))) --DreckFehler''
ups! sorry, i haven't tested the small tweak. it actually didn't much more than the version before. i only changed the pattern [ \t\n\r]+ to \s+ which is virtually the same.
anyway, try the following to get a bit closer to the intended behaviour --DreckFehler
%%(php)<?
// if (ereg( "(=){".$i."}([A-Za-z0-9 ]*)(=){".$i."}", $pagecontent, $title)) {
if (ereg( "(=){".$i."}([^=]+)(=){".$i."}", $pagecontent, $title)) {
?>%%
Deletions:
%%


Revision [1158]

Edited on 2004-09-09 07:58:12 by DarTar [everyone begrudges my merits ;)]
Additions:
''Oops - my humblest apologies :) - DarTar''


Revision [1151]

Edited on 2004-09-08 23:56:06 by JsnX [DreckFehler!?!]
Additions:
++I replaced the code with DreckFehler 's patch (see below)++
''*sigh*, DreckFehler always gets the credit for my code.... :) - JsnX''
Deletions:
++I replaced the code with DreckFehler 's patch (see below)++


Revision [1149]

Edited on 2004-09-08 10:46:44 by DarTar [added link]
Additions:
<<If your wiki supports [[HandlingUTF8 UTF-8]], you can have beautiful **titles encoded in different languages**: just click one of the links listed on [[http://www.openformats.org/TestUTF8 this page]]<<
Deletions:
<<If your wiki supports UTF-8, you can have beautiful **titles encoded in different languages**: just click one of the links listed on [[http://www.openformats.org/TestUTF8 this page]]<<


Revision [1147]

Edited on 2004-09-08 08:53:22 by DarTar [added UTF8 examples]
Additions:
<<If your wiki supports UTF-8, you can have beautiful **titles encoded in different languages**: just click one of the links listed on [[http://www.openformats.org/TestUTF8 this page]]<<
---
Deletions:
<<If your wiki supports UTF-8, you can have beautiful titles encoded in different languages: just click one of the links listed on [[http://www.openformats.org/TestUTF8 this page]]<<


Revision [1146]

Edited on 2004-09-08 08:51:16 by DarTar [oops]
Additions:
Here's the code to add
%%(php) <title><?php echo $this->AddSpaces($this->GetWakkaName())." : ".$this->PageTitle(); ?></title>%%
Deletions:
First save the following code as ##actions/maketitle.php##
%%(php) <title><?php echo $this->AddSpaces($this->GetWakkaName())." : ".$this->Action("maketitle"); ?></title>%%


Revision [1145]

Edited on 2004-09-08 08:49:07 by DarTar [oops]
Additions:
<<If your wiki supports UTF-8, you can have beautiful titles encoded in different languages: just click one of the links listed on [[http://www.openformats.org/TestUTF8 this page]]<<
++I replaced the code with DreckFehler 's patch (see below)++
Deletions:
%%(php)
<?php
$pagecontent = $this->page["body"];
for ($i = 2; $i <= 5; $i++) {
if (ereg( "(=){".$i."}(.*)(=){".$i."}\s+", $pagecontent, $title)) {
$title = str_replace("\"\"", "", $title[2]);
}
}
if ($title) echo $title;
else echo $this->AddSpaces($this->GetPageTag());
?>%%


Revision [1142]

Edited on 2004-09-08 03:24:36 by JsnX [feedback requested]
Additions:
Hi DarTar, thanks for sharing this improvement.
Your original code didn't give the expected results. It was grabbing **everything** between the first set of ""====="" and the last set. Even the revised fix code seemed to do the same thing. For example on this page, here's what it would return:
DreckFehler: your modification wouldn't seem to work at all. It just kept showing the normal wikiword page title.
Below is the regular expression that I came up. It's working, but I'm sure there's room for improvement.
Deletions:
The original code above from DarTar didn't give the expected results. It was grabbing EVERYTHING between the first set of ""====="" and the last set. And even the revised fix code seemed to do the same thing. For example on this page, here's what it would return:
With DreckFehler's modification it wouldn't seem to work at all. It just kept showing the normal wikiword page title.
So I made my own modification to the regular expression and it seems to be working, but I'm sure there's room for improvement, and I'd be happy to get feedback.
Here's what I'm using:


Revision [1141]

Edited on 2004-09-08 02:49:25 by JsnX [still needs revising?]
Additions:
-- DarTar
----
The original code above from DarTar didn't give the expected results. It was grabbing EVERYTHING between the first set of ""====="" and the last set. And even the revised fix code seemed to do the same thing. For example on this page, here's what it would return:
''<title>Wikka : How to get smarter titles""=====""
~-WikiNames make **VeryLongTitlesQuiteDifficultToUnderstand**;
This action adds to the title the highest-level header available in the page (in this case ##""=====""How to get smarter titles</title>''
With DreckFehler's modification it wouldn't seem to work at all. It just kept showing the normal wikiword page title.
So I made my own modification to the regular expression and it seems to be working, but I'm sure there's room for improvement, and I'd be happy to get feedback.
Here's what I'm using:
%%
function PageTitle() {
$pagecontent = $this->page["body"];
for ($i = 2; $i <= 5; $i++) {
if (ereg( "(=){".$i."}([A-Za-z0-9 ]*)(=){".$i."}", $pagecontent, $title)) {
$title = str_replace("\"\"", "", $title[2]);
}
}
if ($title) return $title;
else return $this->GetPageTag();
}
%%
Deletions:
-- DarTar


Revision [1137]

Edited on 2004-09-07 23:01:46 by DreckFehler [small fix: headlines are tagged with 2 to 5 equals]
Additions:
for ($i = 2; $i <= 5; $i++) {
if (ereg( "(=){".$i."}(.*)(=){".$i."}\s+", $pagecontent, $title)) {
Deletions:
for ($i = 1; $i <= 6; $i++) {
if (ereg( "(=){".$i."}(.*)(=){".$i."}[ \t\r\n]+", $pagecontent, $title)) {


Revision [1135]

Edited on 2004-09-07 15:22:01 by DarTar [code fix: avoids parsing error when more top level headers are present]
Additions:
if (ereg( "(=){".$i."}(.*)(=){".$i."}[ \t\r\n]+", $pagecontent, $title)) {
Deletions:
if (ereg( "(=){".$i."}(.*)(=){".$i."}", $pagecontent, $title)) {


Revision [1133]

The oldest known version of this page was created on 2004-09-07 09:19:18 by DarTar [code fix: avoids parsing error when more top level headers are present]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki