[pmwiki-users] Blog, multiple entries per day / Blogging support
Hans
hans.bracker at googlemail.com
Tue Aug 22 14:07:37 CDT 2006
On 22/08/06, Thomas -Balu- Walter <list+pmwiki-users at b-a-l-u.de> wrote:
> I need to check Hans' answer though as he might have just answered it.
You can also see it working on my site:
http://localhost/softflow/design/Blog/Blog
scroll down to headings Blog Feeds and Blog Comments to see the read more link.
But note that I could not just assign a value of 1 to the page variable,
if I did that then all the pagelist items had a readmore link showing.
I had to force a check for the [[#readmore]] anchor string in the page,
and give the result to the page variable.
You can also use a perhaps better function instead of StringCount.
This one will check for the occurence of a string in the page:
# add page variable {$ReadMore},
$FmtPV['$ReadMore'] = 'StringExists($pn,"[[#readmore]]")';
function StringExists($pagename,$find) {
$page = ReadPage($pagename, READPAGE_CURRENT);
if(strstr($page['text'], $find)) return 1;
}
And we can modify it to do a bit more work:
# add page variable {$ReadMore},
$FmtPV['$ReadMore'] = 'RMCheck($pn)';
function RMCheck($pagename) {
$page = ReadPage($pagename, READPAGE_CURRENT);
if(strstr($page['text'], "[[#readmore]]")) return '%comment%RM%%';
}
Then use in the pagelist fmt template for the conditional check:
(:if eq %comment%RM%% {{=$FullName}$ReadMore}:)[[{=$FullName}|read more]](:if:)
and use in your page this shorter anchor-pagevariable pair:
[[#readmore]]{$ReadMore}
The page variable hides itself because it is generated as a comment!
Unfortunately while generating the anchor itself would work,
the conditional check does not, or I have not found out how.
~Hans
More information about the pmwiki-users
mailing list