ConditionalMarkupSamples-Talk
This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.
Comments
In a custom php I use (isset($_POST['abc])) { ... } and it works well, but now I wish to add in a wiki-page something like
(:if isset-post abc:)...(:ifend:),
I tried to write in farmconfig.php the line
$Conditions['isset-post'] = "isset(\$_Post['abc'][\$condparm])";
but it doesn't work. where did I go wrong? Thanks. - Frank January 14, 2019, at 09:10 PM
Did you mean $Conditions['isset-post'] = "isset(\$_POST[\$condparm])";
? --Petko January 14, 2019, at 10:46 PM
Yes, it works perfectly. Gosh, was it so simple? I'm still a php beginner! Thanks Petko - Frank January 14, 2019, at 10:56 PM
How do I check to see if a file is being included in another file? What I want to do is exclude text if the file is included as opposed to when it is displayed separately.
Start the part of the page that you wish to omit with this conditional: (:if equal "{*$FullName}" "{$FullName}":)
- when the part is being displayed on another page the two won't be equal.
What are the "If Auth" equivalents for a skin.php file?
if (CondAuth($pagename,'read')) /* visitor has read permission */ if (CondAuth($pagename,'edit')) /* visitor has edit permission */ if (CondAuth($pagename,'attr')) /* visitor has attr permission */ if (CondAuth($pagename,'admin')) /* visitor has admin permission */
Is there a way to detect if the current page is part of the sidebar? I'd like to have something like:
*Menu1 (:if !sidebar:) **SubMenu1 **SubMenu2 (:if:) *Menu2 (:if !sidebar:) **SubMenu1 **SubMenu2 (:if:)
which would be included by sidebar.
(:if name.... :)
somehow? - But i may not understand the question. What do you mean by: "if the current page is part of the sidebar?" HansB
(:if name NAME:)
evaluates to true if the main page loaded is NAME (for pages in both the main window or sidebar). What I want is when a page is loaded in the main window, it will display the entire menu. When that same page is included by another page (specifically sidebar), it will only display major items (no matter what the main window is displaying).
How I got to this was by ExpandingMenus. But instead of a SideBar-menu page, I'd like to include a detailed page, but in the sidebar hide the details. That way I don't need to update two pages to point to new content.
I maybe crafting a problem to a solution I want. Is there a better way to do something like expanding menus without modifying two pages (Sidebar-menu and a group homepage)?
%sbhide%
may do. You can also use >>sbhide<< ...section to hide in sidebar... >><<
to hide whole sections of the page. So you write:
*Menu1 >>sbhide<< **SubMenu1 **SubMenu2 >><< *Menu2 >>sbhide<< **SubMenu1 **SubMenu2 >><<
$HTMLStylesFmt
[] variable in config.php.
(:if:)
. It's not a good way unless/until it got moved into mainline. Think there is any value to this variable?
Uhm... How do I (:if name Page With Spaces:)?
No such thing, all page names (not to be confused with page titles) are WikiWords, spaces and non 'wiki work characters' are removed from them, see also Links.
(:if equal "{*$Title}" "Page Title With Spaces":)
. --Petko February 16, 2007, at 09:46 AM
Can I ask (:if some-cookbook-recipe-has-been-loaded:)?
Can I test (:if skin SKINNAME:)
to determine the skin that is being used?
Please check the 'if enabled' section above.
- From Petko on the pmwiki-users mailing list:You can define a customPageVariable
{$CurrentSkin}
, see http://www.pmwiki.org/wiki/PmWiki/PageVariables#custompvand in a wiki page, use(:if equal "{$CurrentSkin}" "mobileskinname":)
, see http://www.pmwiki.org/wiki/PmWiki/ConditionalMarkup#built-in-conditions
Is there a way to reference a certain attachment to check whether it exists or not? ~LasseS April 29, 2007
Can I apply multiple arguments?
Would like the sidebar to display items when the name is NOT Website.* or Holiday.* Example:
(:if name [-Website.* && -Holiday.* ] :)This is NOT Website OR Holiday (:ifend:)
With a single argument it works fine. Any ideas? 6-aug-07
This one you can do like (:if ! group Website,Holiday:)
. For other, more complicated, use expr
like this: (:if expr [ ! group Category && auth edit ] :)
You can have brackets and inside them, parentheses if the expression is more complex. --Petko
Can I use wildcards in if attachexists
?
No, the function expects file names and does not allow for wildcards. -- HansB
See Wildcard attach exists. --Petko March 21, 2011, at 11:11 AM
Wildcard AttachExists license
Is the Wildcard AttachExists recipe available under a license? If so, which license? If you like, I can create a Cookbook:WildcardAttachExists? page for it. -- RandyB October 05, 2015, at 03:47 PM
The one on my wiki is very likely derived from PmWiki so same license, "GPLv2 or any newer". However, the recent core (:if attachments FILENAMES PAGENAME:)
feature has rendered this recipe obsolete -- I don't think another page is needed. (Cookbook.ConditionalMarkupSamples should probably be updated to inform visitors.) --Petko October 05, 2015, at 04:44 PM
Done. -- RandyB October 05, 2015, at 05:32 PM
Talk page for the ConditionalMarkupSamples recipe (users?).