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

EE2 Plugin: Question about having a tag within a tag

Development and Programming

esset's avatar
esset
191 posts
16 years ago
esset's avatar esset

Hi

I have a plugin that returns “en” or “sv” (for example) depending on which language the user has choosen.

What I know want to do is to add this en/sv text to my channel field to get the correct field for the specific language. I try doing this like this:

{field_{exp:plugin:code}}

When I run it within the template it just outputs “{field_en}” as a text instead of the actual contents of the field (for example “Headline”).

Any ideas how I can work around this? So the field name gets sent in before the tag tries to fetch the field from the data (I’m guessing that the issue).

Also this doesn’t work either (which it did in EE1.6.x):

{field_<?php echo "en"; ?>}

It also outputs just the tag name like “{field_en}”.

Moved to Plugins by Moderator

       
Herb's avatar
Herb
224 posts
16 years ago
Herb's avatar Herb

Parse order.

Where are you setting the variable {field_en}?

       
esset's avatar
esset
191 posts
16 years ago
esset's avatar esset

Oh sorry

{field_en} is a custom field within my channel. Writing the field name directly like “field_en” works and outputs “Headline” (for example).

Any ideas?

       
John Henry Donovan's avatar
John Henry Donovan
12,339 posts
16 years ago
John Henry Donovan's avatar John Henry Donovan

esset,

Did you write the plugin? Has it been correctly ported to work wth EE 2.0?

Also this doesn’t work either (which it did in EE1.6.x):
{field_<?php echo "en"; ?>}

What is the PHP Parsing Stage of your template?

       
esset's avatar
esset
191 posts
16 years ago
esset's avatar esset

I wrote the plugin. It works with EE2.0. {exp:plugin:code} just does a return on “en”.

PHP parsing is set to YES.

Does this work for you guys?

Thanks

       
John Henry Donovan's avatar
John Henry Donovan
12,339 posts
16 years ago
John Henry Donovan's avatar John Henry Donovan

esset,

Regarding your PHP echo

PHP parsing is set to YES. Does this work for you guys?

Do you have Parsing Stage set to output or input is what I mean. See attached.

Regarding your plugin

I wrote the plugin. It works with EE2.0. {exp:plugin:code} just does a return on “en”.

You may be better off posting to the ExpressionEngine 2.0 Beta: Add-ons forum with your actual plugin code as its not necessarily technical support.It may just be a parsing issue.

       
esset's avatar
esset
191 posts
16 years ago
esset's avatar esset

Hi John

Changing PHP parsing state to “INPUT” worked for {field_<?php echo "en"; ?>}

It now outputs “Headline” from the channel field in my template.

But it didn’t do anything for {field_{exp:plugin:code}}.

Shouldn’t these work the same way?

plugin:code function is just as follows:

function code(){
return "en";
}
       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

esset, we don’t provide direct support for writing plugins in this forum. Moving to Plugins Forum.

       
esset's avatar
esset
191 posts
16 years ago
esset's avatar esset

Okay…

Then I ask the general public if anyone know how EE parses the tags within a channel since it works when PHP writes “en” to the tag but not when a plugin does a return on the same value back.

Is the plugin someone slower/executes after the channel field tag(?)

Thanks all

       
esset's avatar
esset
191 posts
16 years ago
esset's avatar esset

Don’t know if this has anything todo with anything, but trying to assign the return value to a preload_replace variable doesn’t work either:

{preload_replace:variable_name={exp:plugin:code}}
       
esset's avatar
esset
191 posts
16 years ago
esset's avatar esset

Just tried the same with a basic module that just returns a value like “en” and the result is the same.

Is the parsing stage for these stacked up somehow?

       

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.