View Full Version : Inserting code into another page, not transclusion
rickyhow
09-07-2008, 10:29 PM
The requirement:
To insert XHTML code into a page, when the page is determined at runtime.
This code almost works:
{{ web.Html("<div class='fact'>
<h6>Fact: Bulleted List</h6>
<p>Stem sentence</p>
<ul>
<li>First list item</li>
</ul>
</div>") }}
Problems with this code:
1. I need to insert the actual code - similar to how SUBST: worked. Currently the section that is created cannot be edited as a section.
2. I need to insert this code in a page that is determined at runtime.
SteveB
09-08-2008, 02:24 PM
When do you want this code to be inserted permanently? When the page is edited? At not other point, can you modify the page contents.
It is possible to inject persistent content, but usually it's either done at save time (save: ) or edit time (edit: ). Either method works, but you can't inject persistent content when a page is only viewed.
rickyhow
09-08-2008, 03:16 PM
The code would be inserted at save time.
The idea is to give the user the ability to specify a new page including the sections that the page will consist of. The page is created programatically, not directly by the user.
SteveB
09-08-2008, 08:22 PM
I assume you already know about the "save:" prefix:
{{save: 'this will be inserted at save time' }}
Can you just insert all possible elements and then ask the user to remove those they don't want?
rickyhow
09-08-2008, 08:57 PM
This comes very close to what I am looking for:
{{save: web.Html("<div class='fact'>
<h6>Fact: Bulleted List</h6>
<p>Stem sentence</p>
<ul>
<li>First list item</li>
</ul>
</div>") }}
However I need to be editing the page. Is there a way to use wiki.create with save: ?
SteveB
09-08-2008, 09:10 PM
You can't create a page without going through the edit step. Otherwise, an evil script could go around and create thousands of pages without any balances and checks...
rickyhow
09-08-2008, 09:12 PM
What about using the args parameter?
Powered by vBulletin™ Version 4.1.3 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.