Include Other Pages-Talk
Are there any solutions to specify the amount of words to be included instead of lines?
My favorable solution would be to have something like (:include PageName#anchor words=30:)
, which would mean: include 30 words after the anchor #anchor. Is there any implementation of this?
Is it possible to include pages without turning them into a block?
eg I am looking for something like the PageList wrap parameter
Is it possible to create a default for a variable?
Displaying Error Messages
Include failure by default does not display error messages. You can test for errors because "Multiple pages may be specified, but only the first available is included".
You can create a default error message by using 2 pagenames to be included. The first page is the page to include, and the second page displays if the first include fails. You can specify any page as an error page.
In this example I use PageTextVariables so I only have to define the pagename once for each page to be included, and Parameter References to display the pagename on the error page.
In page Site.IncludeFailed put:
In the page doing the including define the pagenames to be included:
Then include the pages:
Error output looks like this:
(:P1:badpagename:) (:include {$:P1} IncludePage={$:P1} Site.IncludeFailed:) |
I moved this section to the talk page, because it suggests to use very complicated markups for a simple error message. I'm not sure if anyone will type all this just to display a missing pagename from the template, when it is so easy to re-edit your page and to fix the include link, when it is needed. Now, while I'm sure it is not required to be in the core documentation, I see no problem for it to be here on the talk page. On every wiki installation there is a direct link to this page. --Petko? November 29, 2009, at 05:28 PM
Please note also that the core feature is outlined in the main page, so users will find it. (They will, if they read the documentation.) --Petko? November 29, 2009, at 05:31 PM
Petko, I cannot believe you or anyone who is using wiki includes would consider this complicated. Do you ever write programs that read a file and not check to see if the file exists? This will make sure that if someone does an include it will work. Someone's include might fail and all they get is missing content that they would not notice in the output. This makes it much more robust. If you really don't care that content you write is accurate, don't use this. I have a higher standard.
Sometimes people don't notice some details. In an ideal world everyone would read everything and follow it exactly. And then we would not need bold text, or color. A detail like this needs more emphasis to be noticed by the average user.
It can be simplified even further:
(:include badpagename IncludePage=badpagename Site.IncludeFailed:) |
It scales bad, if you have more pages: (:include somegroup.badpagename1 somegroup3.badpagename2 somegroup4.badpagename3 IncludePage="somegroup.badpagename1 somegroup3.badpagename2 somegroup4.badpagename3" Site.IncludeFailed:)
It's also funny that you suggest authors to create and use PageTextVariables, or even write the pagenames twice (a second time in the IncludePage= parameter), when it would be enough to write them once, but correctly. If you type your pagename correctly, your page will be included, if it is not included, check your text, period. An average user wanting to include a page, will notice if the page is not included -- you obviously have lower standards about your average users if you underestimate them like that.
If you really believe it is highly valuable and useful, please feel free to create and support a cookbook? recipe. --Petko? December 01, 2009, at 12:31 AM
This is a talk page for improving PmWiki.IncludeOtherPages.