![]() |
|
how to include a page in another page ? - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: how to include a page in another page ? (/thread-11662.html) |
how to include a page in another page ? - vincent3569 - 2014-02-27 hi I have a page called "license" (and with a TitleLink called 'license'). I want to include licence page content in theme page. I add this code in codeblock, but it doesn't work : How should I do that ? how to include a page in another page ? - acrylian - 2014-02-27 1.4.5.9 or 1.4.6? `` Beside that the object model should always work (Which this uses internally): how to include a page in another page ? - vincent3569 - 2014-03-01 my page was unpublished, so, I have to set 2nd parameter... is there a macro do do that (insert page contents anywhere in another page content) ? how to include a page in another page ? - acrylian - 2014-03-01 No, no macro for that exists currently. All can be done, could be part of Zenpage but will have to wait after 1.4.6. then. Or an independent plugin like this https://github.com/acrylian/zenpage_subpages. You can enable the macro plugin to get a list of all available macros. how to include a page in another page ? - acrylian - 2014-03-01 No, no macro for that exists currently. All can be done, could be part of Zenpage but will have to wait after 1.4.6. then. Or an independent plugin like this https://github.com/acrylian/zenpage_subpages. Seems usefull so I might give it a shot the next days as an "half official" plugin. Btw, you can enable the macro plugin to get a list of all available macros. how to include a page in another page ? - vincent3569 - 2014-03-03 hi I had a look on your plugin that add a content macro and I read content macro tutorial (http://www.zenphoto.org/news/content-macros).
how to include a page in another page ? - vincent3569 - 2014-03-03 this plugin doesn't work ` how to include a page in another page ? - acrylian - 2014-03-03 The answer is of course 42 :-) Seriously that is the priority of the plugin load order. From a quick look: Your plugin does not work because you have to define the actual funtion to return the content of the macro. Calling outside functions does not work because of the parameters. But you don't need to bother, I have a plugin on my list for articles and pages content already so if you can wait 1-2 days. how to include a page in another page ? - vincent3569 - 2014-03-03 of course, I can wait if somebody does the job for me ;-) in exempleMacro, there is CODEBLOCK macro which refer to outside function, and it works how to include a page in another page ? - acrylian - 2014-03-03 Right, indeed, my mistake looking to quickly at it. I cannot answer right now without looking more at it. The difference is the "procedure" vs "function" and "get" vs "print": how to include a page in another page ? - vincent3569 - 2014-03-03 this plugin works : ` how to include a page in another page ? - acrylian - 2014-03-03 I cannot answer at the moment I mostly go this way, too. Could be the owner maybe. I always tend to use the object model instead of template functions. For extra content fields you even have to as you cannot call them directly otherwise, those my plugin was meant to support as well. how to include a page in another page ? - vincent3569 - 2014-03-03 your plugin will be most robust and complete than mine. but 2 questions : for the 2nd question, some explanation : ` blabla blabla ` how to include a page in another page ? - acrylian - 2014-03-03 Mine is not that much different from yours, just a bit more complete: Regarding the wrong html I fear there is no easy way to prevent that. When the macro is entered TinyMCE by default wrapps it with a paragraph as with all text you enter. It does not "know" that that also prints html on the front end. The only way would be to disable this behaviour but that causes other issues. Actually we then had to replace line breaks with paragraphs and such before outputting anything. I am honest I cannot exactly explain the difference between procedure, function and expression types. For procedure and function it is probably that the first works with functions that print/echo something while the function one uses return values and prints them itself. The doc needs to be clearer with the actual differences. how to include a page in another page ? - acrylian - 2014-03-03 I just looked all plugins I did with macros use only the function and sometimes the constant one. how to include a page in another page ? - vincent3569 - 2014-03-03 ok tkanks for the plugin (and the inspiration :-) some comments about it :
how to include a page in another page ? - acrylian - 2014-03-03 Indeed, the first should be and is technically as it does not make any sense to not set it ;-) Those could be part of Zenpage but maybe it would make sense to keep them separate but collect in one. In any case for 1.4.6 we have feature freeze already. Update: I have renamed the repo to "zenpage_macros" and will merge it to a plugin of the same name. I can later decide if this gets incorporated into Zenpage as well. Update 2: I have now merged both and renamed the plugin. Please test so I have no type anywhere :-) https://github.com/acrylian/zenpage_macros how to include a page in another page ? - vincent3569 - 2014-03-04 I opened à ticket : https://github.com/acrylian/zenpage_macros/issues/1 |