Member
Member
vincent3569   2014-02-27, 15:19
#1

hi

I have a page called "license" (and with a TitleLink called 'license').
I have another page called "theme".

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 ?
Is there a content macro to do that ?

Administrator
Administrator
acrylian   2014-02-27, 16:32
#2

1.4.5.9 or 1.4.6?

``
That should work. You need to set the 2nd parameter if it is an unpublished page.

Beside that the object model should always work (Which this uses internally):
$page = new ZenpagePage('license'); echo $page->getContent();

Member
Member
vincent3569   2014-03-01, 09:14
#3

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) ?

Administrator
Administrator
acrylian   2014-03-01, 10:48
#4

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.

Administrator
Administrator
acrylian   2014-03-01, 10:48
#5

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.

Member
Member
vincent3569   2014-03-03, 15:40
#6

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).
I have questions about macro :

  • what are the differences between procedure, function and expression ?
  • in your plugin, you have $plugin_is_filter = [b]9[/b]|THEME_PLUGIN|ADMIN_PLUGIN;, but in tutorial, $plugin_is_filter = [b]5[/b]|THEME_PLUGIN|ADMIN_PLUGIN; is mentioned : what is the difference between 5 an 9 (please, don't answer 4 :-) )
Member
Member
vincent3569   2014-03-03, 16:07
#7

this plugin doesn't work

`

Administrator
Administrator
acrylian   2014-03-03, 16:13
#8

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.

Member
Member
vincent3569   2014-03-03, 16:34
#9

of course, I can wait if somebody does the job for me ;-)
but, I would like to understand where is the matter...

in exempleMacro, there is CODEBLOCK macro which refer to outside function, and it works
[...] 'CODEBLOCK' => array( 'class' => 'procedure', 'params' => array('int'), 'value' => 'printCodeblock', 'owner' => 'exampleMacros', 'desc' => gettext('Places codeblock number [code]%1[/code] in the content where the macro exists.')), [...]

Administrator
Administrator
acrylian   2014-03-03, 17:19
#10

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":
http://www.zenphoto.org/news/content-macros#standard-macros

Member
Member
vincent3569   2014-03-03, 17:21
#11

this plugin works :

`

Administrator
Administrator
acrylian   2014-03-03, 17:36
#12

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.

Member
Member
vincent3569   2014-03-03, 17:51
#13

your plugin will be most robust and complete than mine.

but 2 questions :
1- what are the differences between procedure, function and expression ?
2- how avoid html error generated by tinyMCE ?

for the 2nd question, some explanation :
in tyneMCE, I added my macro like that [PAGE_CONTENT 'license' false].
tyneMCE automaticaly wrapped this text by html tag.
but as I insert my page content, it generate wrong html flow like

`

blabla

blabla

`

Administrator
Administrator
acrylian   2014-03-03, 18:21
#14

Mine is not that much different from yours, just a bit more complete:
https://github.com/acrylian/zenpage_content

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.

Administrator
Administrator
acrylian   2014-03-03, 18:25
#15

I just looked all plugins I did with macros use only the function and sometimes the constant one.

Member
Member
vincent3569   2014-03-03, 19:13
#16

ok

tkanks for the plugin (and the inspiration :-)

some comments about it :
according to me

  • the first paramater (titlelink) should be mandatory in all macro (lines 77, 84, 91, 98)
  • the parameter $titlelink shouldn't have a default value $titlelink = '' (lines 31, 35, 38, 42)
  • maybe, you can aslo create a macro toi display and exerpt of the latest news
  • all your macros (include zenpage_subpages) should be macro of zenpage plugin and added to the plugin (as SLIDESHOW macro is included in slideshow plugin).
Administrator
Administrator
acrylian   2014-03-03, 19:26
#17

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
Latest news sounds like a good idea, although it will have the same issue with tinymce and paragraph wrappers.

Member
Member
vincent3569   2014-03-04, 08:41
#18

I opened à ticket : https://github.com/acrylian/zenpage_macros/issues/1

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.