[pmwiki-users] php q

noskule noskule at gmx.net
Mon Jul 16 13:05:11 CDT 2007


noskule schrieb:

I figured out that I have to make a markup expression to do something
like that:

({topicbasename "{$editgroup}.{$editname}"})

I took a look at the markup expression script but couldn't realy
understand it. Works this so that I could define a function like
topicbasebame and call it with the markupexpression markup?


Something like:
function TopicBaseName ($pagename, $Name) {
	$name = PageVar($pagename, $Name);
	$backnametopic = explode('-Topic-',$name);
	$backnametopic = $backnametopic[0];
	$FmtPV['$TopicBaseName'] = "'$backnametopic'";
	}

and how would I define a markup-expression that executes the
TopicBaseName function?






> hi list
> I have some trouble to get this php code to runn properly, could please
> someone giving me a hand?
> 
> I try to get the basename of a page:
> 
>     SomeGroup.SomeName-Topic-12 -> SomeGroup.SomeName
> 
> GLOBAL $TopicBaseName,$CommentBaseName;
> 
> $name = PageVar($pagename, '$Name');
> $backnametopic = explode('-Topic-',$name);
> $backnametopic = $backnametopic[0];
> $FmtPV['$TopicBaseName'] = $backnametopic;
> 
> this work like expected.
> 
> 
> SomeGroup.SomeName-Topic-12-Comment-3 -> SomeGroup.SomeName-Topic-12
> 
> $name = PageVar($pagename, '$Name');
> $backnamecomment = explode('-Comment-',$name);
> $backnamecomment = $backnamecomment[0];
> $FmtPV['$CommentBaseName'] = $backnamecomment;
> 
> this don't work and gives me: -12
> 
> 
> does anyone have an idea what I'm doing wrong?
> Thanks for any hints
> nos
> 
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
> 




More information about the pmwiki-users mailing list