Smarty Markup in Entries

Found a bug? Tell us!!
Cel
Regular
Posts: 17
Joined: Sat Jan 26, 2008 12:46 am

Smarty Markup in Entries

Post by Cel »

Hi,

Until now I was just using smarty markup in static pages and everything was fine. Today I enabled smarty markup in entries and now everything seems to be broken.

If I enable smarty markup in entries, the markup plugin no longer recognizes the smarty tags in either static pages or entries and gives me a fatal error.

Since I discovered that caching in the extended properties plugin might cause problems I removed that plugin entirely, but that did not help.

For a short period it appeared to be working fine in entries. I declare a (local) smarty variable in the entry with {assign var='xxx' value='yyy'} could that be a problem ?

Many Thanks,
Regards,
Cel
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Smarty Markup in Entries

Post by garvinhicking »

Hi!

If you get any errors, be sure to include them, so that someone can help you. :-)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Cel
Regular
Posts: 17
Joined: Sat Jan 26, 2008 12:46 am

Post by Cel »

Hi Garvin,

The error message that I get when turning smarty markup on for entries looks like this:

Fatal error: Smarty error: [in smartymarkupplugin:1232260604 line 4]: syntax error: unrecognized tag: window.open('displayresult.php'); return false; (Smarty_Compiler.class.php, line 446) in ~/bundled-libs/Smarty/libs/Smarty.class.php on line 1095

The actual static page contains these lines:

{literal}
<script type="text/javascript">

function formValidation(form){
window.open('displayresult.php');
return false;

}

</script>
{/literal}

Like I said, I only get the error when turning smarty markup on for entries. If I just turn it on for static pages the markup plugin processes the {literal} tags without problems.

Regards,
Cel
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I'll try to reproduce this. Do I understand you right: You get this error on the STATIC PAGE, when you enable it for entries? That's strange, because enabling the 'entries' markup should not affect the rendering of the staticpage...

If you use {ldelim} and {rdelim} instead of {literal}... to escape quotes, does it work then?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Cel
Regular
Posts: 17
Joined: Sat Jan 26, 2008 12:46 am

Post by Cel »

Hi Garvin,

You are right, I get this error on a static page if I turn on smarty markup for entry body text. It may be difficult to reproduce since it appeared to be working fine at first (maybe 2 hours). That's why I suspected that caching might have to de something with it.

Using {ldelim} {rdelim} makes no difference: Fine as long as smarty markup for entries is not enabled, else I get the same error. It looks like it does not recognise any tags when it is enabled for entries. (maybe it no longer recognizes the {} as smarty delimiters ?)

I did some further investigation and found that phpMyAdmin displays an error/warning on the table called serendipity_entryproperties:

UNIQUE and INDEX keys should not both be set for column `entryid`

The table is empty. Maybe this is wrong ?

Regards,
Cel
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Maybe you can try to clean your templates_c directory? That's where the smartymarkup plugin puts its files?

The PMA report about the table is unrelated.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Cel
Regular
Posts: 17
Joined: Sat Jan 26, 2008 12:46 am

Post by Cel »

Hi,

Cleaning templates_c makes no difference. I get the same result.

However, I noticed that even when it produces the error message, the php file that the plugin generates in templates_c looks perfectly OK.

Here is the top part of it:

*********************************************
<?php /* Smarty version 2.6.18, created on 2008-01-29 22:01:37
compiled from smartymarkupplugin:-1353023445 */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'gen_session_id', 'smartymarkupplugin:-1353023445', 30, false),array('function', 'gen_completion_time', 'smartymarkupplugin:-1353023445', 31, false),)), $this); ?>
<?php echo '
<script type="text/javascript">

function formValidation(form){
window.open(\'displayresult.php\');
return false;

}

</script>
'; ?>
*******************************************

So even when it complains about not recognising tags, it does generate correct output in templates_c.

Regards,
Cel
Cel
Regular
Posts: 17
Joined: Sat Jan 26, 2008 12:46 am

Post by Cel »

Hi Garvin,

One more comment: I also noticed that entries.tpl generates a php file in templates_c when I just reload the static page.

Regards,
Cel
Cel
Regular
Posts: 17
Joined: Sat Jan 26, 2008 12:46 am

Post by Cel »

Maybe it is parsing twice ?

Once as a static page and then the result as an entry ?
Cel
Regular
Posts: 17
Joined: Sat Jan 26, 2008 12:46 am

Post by Cel »

That seems to be true. If I disable parsing of static pages and just enable parsing of entries the static page displays correctly.

However, I then get the same error with normal entries. It looks like normal entries are also parsed multiple times.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Could you post your complete list of event plugins that you are using, along with their version numbers and their order inside your plugin management?

Also, which serendipity version are you using, and which template? Maybe your URL could also help.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Cel
Regular
Posts: 17
Joined: Sat Jan 26, 2008 12:46 am

Post by Cel »

Hi Garvin,

I did some further investigation. I have now disabled smarty markup for static pages and enabled it for entries. Static pages are now displayed correctly (with smarty markup !), but for normal entries I get an error message like:

Fatal error: Smarty error: [in smartymarkupplugin:301859496 line 1]: syntax error: unrecognized tag: - signs are not allowed in en_uq_id (Smarty_Compiler.class.php, line 446) in ~/bundled-libs/Smarty/libs/Smarty.class.php on line 1095

where the entry body starts with:

{* - signs are not allowed in en_uq_id *}

The url is not ready for publishing. This is the order and version number of plugins:

serendipity_categories_plugin:
serendipity_plugin_linklist:1.15
serendipity_syndication_plugin:
serendipity_event_s9ymarkup:1.3
serendipity_event_emoticate:1.6
serendipity_event_smartymarkup:1.5
serendipity_event_contactform:1.13
serendipity_event_staticpage:3.60
serendipity_event_faq:1.10
serendipity_event_browsercompatibility:1.1
serendipity_event_spamblock:1.68

I am using serendipity version 1.2
I could not find the version number of serendipity_categories_plugin and serendipity_syndication plugin.

Regards,
Cel
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

For entries, the plugin "Serendipity markup" interfers.
Try to move the smartymarkup plugin to be the first of your event plugins?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Cel
Regular
Posts: 17
Joined: Sat Jan 26, 2008 12:46 am

Post by Cel »

Hi Garvin,

That fixed the problem ! Although, the configuration of the Smarty Markup Plugin is now somewhat confusing, everything works as I want it to. I hope I do not run into similar problems when I enable smarty Markup for html nugget in the future :-)

Is there maybe a document that explains the consequences of the order of plugins ?

Many thanks for all your quick replies !
Regards,
Cel
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I'll now definitely look into the problem of enabling both "for entries" and "for staticpage" possibility. Usually they should not interfer.

After re-ordering the plugins, have you checked if it maybe now works when having both options enabled?
Is there maybe a document that explains the consequences of the order of plugins ?
The order of the plugins indicates, in which order markup transformations are applied. The s9y markup plugins transforms *blabla* to <strong>blabla</strong>, and did that to your {* ... *} markers. The next marku plugin always gets the output that the previous plugin modified, so the smarty one would get {<strong> ...</strong>} which is invalid smarty markup. :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply