Preview exceptions [solved]

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
chiggeybean
Forum Members
Forum Members
Posts: 18
Joined: Tue Jan 29, 2008 11:29 pm

Preview exceptions [solved]

Post by chiggeybean »

In 1.5, I used the following code to avoid a bug that caused the preview to crap out.

Code: Select all

{if $SCRIPT_NAME != "/preview.php"}
       {sectiontitle levels='2'}
{/if}
This would allow my tag to render results in a browser, nothing in preview.

Now in 1.6.6, the preview mechanism has apparently changed and the above no longer works. I noticed the page is now editcontent.php, but replacing preview.php with editcontent.php doesn't seem to work either.

Anyone have an idea how to do this?
Last edited by chiggeybean on Sun Jun 13, 2010 3:25 pm, edited 1 time in total.
chiggeybean
Forum Members
Forum Members
Posts: 18
Joined: Tue Jan 29, 2008 11:29 pm

Re: Preview exceptions

Post by chiggeybean »

Still a problem - thought I'd bump this to see if anyone had an idea. Now on 1.7.1
NaN

Re: Preview exceptions

Post by NaN »

What bug do you mean?
And why should the {sectiontitle ... } only be shown if not in preview?
Where do you put these lines?

If i print out {$SCRIPT_NAME} in a page content i see "index.php". Even if viewing the page in preview tab.
No preview.php nor editcontent.php.

The only thing to check if you're in preview is to check for the page that is showed.
If it is "__CMS_PREVIEW_PAGE__" you're in preview.

E.g. if in your config.php $config['query_string'] is set to "page" the url to the preview page is

yourDomain/index.php?page=__CMS_PREVIEW_PAGE__

So if you want things not to be processed in preview i would do it that way:

{if $smarty.get.page != '__CMS_PREVIEW_PAGE__'}
...
{/if}

I don't know if this is what you're looking for.
chiggeybean
Forum Members
Forum Members
Posts: 18
Joined: Tue Jan 29, 2008 11:29 pm

Re: Preview exceptions

Post by chiggeybean »

Thanks NaN! That worked perfectly.

The reason I do this is that {sectiontitle} causes preview to not render. By leaving this one little thing out of the preview, it works fine.
Post Reply

Return to “CMSMS Core”