Is there a way for PHP-code or HTML-code to see if a page is displayed in RW7-preview mode, live-preview mode or normal published-mode?
I need to set an explicit path to some PHP-includes in preview-mode.
Thanks,
Marc Vos
Is there a way for PHP-code or HTML-code to see if a page is displayed in RW7-preview mode, live-preview mode or normal published-mode?
I need to set an explicit path to some PHP-includes in preview-mode.
Thanks,
Marc Vos
You would be able to do that with help of the Stacks Plugin API. That needs you to create a Stack, so might be a bit too much effort?
It’s a piece of PHP code inside a HTML stack. It would be nice if I can use something like if(%%mode%% == ‘preview’) or so.
I can also duplicate the HTML-stack itself and make changes to it … but what change would I make to get what I want?
Thanks,
Marc
Ok, thanks for the link. I’ll make a stack then and give it a try. I’m enabling the Rapidblog PHP code to display a Blogger feed in a stacks page, for use with Foundry. Rapidblog is a page-plugin and can’t be used with Foundry.
So making stacks out of it is a nice idea.
Marc
I’m having a total misunderstanding of how to get content of a stack visible or published (cq. exported).
I have this:
%[if edit]%
Blogger posts stack
%[endif]%
%[if !edit]%
<?php
Lots of PHP code
?>
%[endif]%
in a ‘template.php’, with ‘preprocessor’ OFF.
I also tried with
%%[[if edit]]%%
Blogger posts stack
%%[[endif]]%%
%%[[if !edit]]%%
<?php
Lots of PHP code
?>
%%[[endif]]%%
with ‘preprocessor’ set to ON.
The plist for ‘templates’:
<dict>
<key>filename</key>
<string>template.php</string>
<key>scope</key>
<string>page</string>
<key>type</key>
<string>php</string>
</dict>
And I can’t get it to work.
I want it be a ‘control’ stack, like the Foundry-control stack. Use once on a page, and no stacks may be dragged into it.
What am I doing wrong?
Ok, I got it, the API docs weren’t clear.
I changed the extension back to HTML, also in the plist.
That did at least generate content, but inside the HEAD section. Reason: I had the scope of the template-file set to ‘page’. I hoped that the content would be included in-place, but just once. Instead, it was placed in the head-section.
So I changed the scope back to ‘each’ and now it does want I want.
Previewing now also works.
Cheers,
Marc
This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.