10

Use Mo' Variables. It will give you access to GET variables like this {get:your_key} (in your case {get:score}). Mo' Variables has many other uses, as well!


4

Using the matches operator, which was added in EE v2.9.0: {if segment_2 ~ "/^\d+$/"} [...] {/if}


3

The easier and faster way to do this is using Preload Text Replacements and snippets. Snippets are parsed before Preload Text Replacements. So you can put them inside snippets. Let me show you an example. This is part of a snippet called doctype-and-styles-snip: {preload_replace:pre-rootclass=""}<!doctype html> <html class="no-js no-jquery {if ...


3

You can use Stash for this as well. Just create a variable for each value from the channel entry that you want to use. It seems like you want a less manual process, but there isn't a default EE way of doing that. You probably could build a third party add-on to do something like this, but there aren't any that I know of that have this functionality.


3

Use Stash - Here's how: {!-- ============================================ STORE A LIST OF RELATED ARTICLES INTO A LIST ================================================== --} {!-- first the manually chosen ones --} {exp:stash:set_list name="rels" parse_tags="yes" trim="yes"} {exp:channel:entries channel="article"} {related_articles} ...


3

That's Parse Order. Advanced conditionals, like the one in your example, are parsed after PHP is parsed. In fact, it doesn't even matter if PHP is set on Output or Input. So, think of this step by step. First, your PHP is executed, echoing both 1 == 1 is true and 1 == 1 is false. And the var $test is first set to hello, then to goodbye, after which the ...


2

Your issue here is one of parse order. Changing to php on input won't help. Leave it on output. I just tested this: {exp:channel:entries channel="blog" limit="1"} <?php $php_7_days_before = date ("Y-m-d H:i", floor('{entry_date}' - 604800)); ?> {/exp:channel:entries} {embed="site/php_test" 7daysbefore="<?php echo $php_7_days_before; ?>" } ...


2

Set PHP Parsing Stage to 'Input' in your template file.


2

There's a better way, though I'm not sure what where you're trying to insert the entry's category_id. Use Stash, you'll be glad you did. {exp:channel:entries} {exp:stash:set name="category_id"} {categories limit="1"} {category_id} {/categories} {/exp:stash:set} {/exp:channel:entries} <!-- Then get it after entries ...


2

Alas you don't mention where you get $config from. I've assumed it's a global class variable below. public function outputBrowser($results) { $data = array( "results" => $results, "config" => $this->config ); $this->EE->load->add_package_path($this->report_path); return $this->EE->load->view('...


2

Not sure what existing solution there are, but I would just create a real simple plugin with pkg.io. Basically, your constructor method would look like this: public function constructor() { $json = json_encode($this->EE->TMPL->fetch_param('json')); // Now you need to parse the JSON object. This will be unique // depending on what your ...


2

You'll need an embed, with or without stash. I always prefer to not use add-ons if I can. So, without stash: {exp:channel:entries status="featured" limit="1"} <div class="featured"> [...] </div> {embed="entries/.list" featured_id="{entry_id}"} {if no_results} {embed="entries/.list" featured_id="0"} {/if} {/exp:...


2

I see that you have php preg_match but no opening/closing php tags. Are those elsewhere in the code? If not then add opening/closing php tags and see what happens.


2

A good starting point for an error like this is to reduce your code... remove your conditional line by line until you find the offending line. Also, try this patch posted to a similar EE bug: https://support.ellislab.com/bugs/detail/17989


2

Embeds are normally parsed at the end. You can try setting a variable with Stash. In the main-template get the variable at process-end. A better approach is to use stash to store your data in the first place, and avoid an extra embed altogether. https://github.com/croxton/Stash // template1 ----------------------------------------- {exp:stash:set name="...


2

exp:stash:get_list is a variable pair. So, try exp:stash:list_count: {exp:switchee variable="{exp:stash:get name='custom_sidebar_text'}/{exp:stash:list_count name='related_articles'}/{exp:stash:list_count name='related_events'}" parse="inward"} {case value="/0/0"}{/case} {!-- Ignore no value --} {case default="Yes"} <aside class="{exp:stash:...


2

You should try separating the data-fetching from the markup-assembly - this way you'll be able to cleanly fetch all your member variables and store them into Stash vars for use later (either in the same template or an embedded one). Here's a tutorial I wrote describing how to do this: http://www.jamessmith.co.uk/articles/expressionengine-stash-tutorial-level-...


2

I've found a way to do this; not sure its the 'right' way, but it works and seems logical :-) {exp:plugin_name parse="inward" variable_to_pass="{some_id}"} Then in the plugin: $my_var = $this->EE->TMPL->fetch_param('some_id');


2

If your trying to pass a simple value to your layout, you can set it on the layout tag. For example: {layout="pages/.layout" body_class="contact"} But custom fields variables need to be parsed by the channel:entries variable pair. This is the reason for the tag layout:set. {exp:channel:entries [...]} {layout:set name="desc"}{timeline_item_description}{...


2

Unfortunately, for now, version 2.9, there isn't. But I suggest you to ask EllisLab for it. I guess isn't that hard to implement, but they are possibly busy because of the EECI Conf. This and an output parameter can be really useful.


2

First of all, the stylesheet tag needs quotation marks. {stylesheet="global_embeds/style"} If you link to the JS file using path variable, all the templates variables on the linked file will be parsed. {path="global_embeds/init.js"} But I really don't think it's good for performance. It's much better to use static links for the JS and CSS.


2

From my own testing, the value set for the {layout:title} variable will cascade back through the layout templates to the outermost layout. So if you set it in a nested template or a template that ultimately uses the global layout, then the value of the variable will be available to the global layout. If you set the {layout:title} variable in a nested ...


2

There are some issues in EE 2.9 with conditionals on prefixed variables and variable modifiers which I don't totally grok. (See bug report here for some discussion.) But the moral is, try this: {if '{promotions:tour_show_specials_banner}' == 'y'}


1

Try the Wires addon. Mark, who created switchee and ifelse, is yet writing the docs and improving the code, but, by my tests, it's stable.


1

This doesn't works because this conditional isn't a simple one, so the template parser tries to parse the exp:calendar:cal before the conditional. Simple conditionals looks like this: {if foo == "bar"} They are parsed before at the stage 13 on Rendering stages. Everything else are advanced conditionals, parsed at stage 18. So, {if {current_time format="%...


1

Try adding parse_depth="x" to the Stash embed, where 'x' is a number greater than 4 (which is the default). EDIT: You are effectively using the embed like a snippet, so I would suggest including the embed before tag processing begins, without parsing it so that you can still pass it variables during: {stash:embed name="my_total{count}" file_name="_stash:...


1

I did the math within the SQL to receive my results. EDIT: The solution. SELECT COUNT(entry_id) / 25 AS count FROM exp_channel_data WHERE channel_id = 97


1

$this->return_data = $this->getMyString(); return_data should only be used for the construct method (nod to Derek ;). In the EE template: {exp:test}woo hoo{/exp:test} or {exp:test:getMyString}woo hoo{/exp:test:getMyString} I appreciate this is only a test, but you can't return anything from the construct if you're returning stuff from the methods ...


1

If you need to modify the variable in the process of template parsing, I would suggest creating a plugin that will utilize EE Session cache. Depending on your exact needs, you may find Low Variables useful as well.


1

How about something like this? {matrix} {exp:channel_images:images_static entry_id="{entry_id}"} {image:{element_count}} {/exp:channel_images:images_static} {/matrix} ({element_count} is the matrix field where you can choose the #-th image).


Only top voted, non community-wiki answers of a minimum length are eligible