We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin code get parsed although conditional is false

Development and Programming

Musa's avatar
Musa
124 posts
15 years ago
Musa's avatar Musa

Hello, I’ve developed a small plugin, For example this plugin process some string based on weblog entries. Plugin has some DB interaction too. Following is example code -

{if segment_3==""}
    {exp:weblog:entries weblog="my_weblog" disable="member_data|pagination|trackbacks" dynamic="off"}
        
        <h2>{title}</h2>

        <div>
        {exp:word_limit total="2"}
        text you want processed
        {/exp:word_limit}
        </div>
        
        
        {exp:myplugin:process entry_id="{entry_id}"}
            {processed_string}
        {/exp:myplugin:status}
        
        
    {/exp:weblog:entries}
{/if}

CASE 1: If we place this code on a template and browse that as following url - http://mydomain.com/segment_1/segment_2/ it should display data as starting conditional is TRUE.

CASE 2: and nothing should be displayed if i browse as starting conditional is FALSE. http://mydomain.com/segment_1/segment_2/segment_3

and this work for me too. But i saw it loads slow. Later i’ve enabled the template and sql debugging to see why it loads slow and saw that, the quries and tags for false conditional is processed by template parser too (For CASE 2)!

That is for url http://mydomain.com/segment_1/segment_2/segment_3, the following plugin code (myplugin and word_limit)

{exp:myplugin:process entry_id="{entry_id}"}
            {processed_string}
        {/exp:myplugin:status}

which should not be processed by template parser as segment_3!=”“.

But if i remove my plugin code and keep word_limit plugin code(that came with EE), word_limit plugin code is not processed by template parser as segment_3!=”” and conditional is true. It seems, something is wrong in my plugin, would you help me to find out the issue.

This in EE 1.7, sorry to post here as i could not post on archived_forums.

Thanks Musa

       
Musa's avatar
Musa
124 posts
15 years ago
Musa's avatar Musa

It seems, it get parsed as i’ve used advance conditional.

Any feedback?

Thanks Musa

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.