Plugin

Archived
Forum
(read-only)

CE String

ExpressionEngine 2, ExpressionEngine 3

Back to this add-on's main page
View Other Add-ons From Causing Effect

     

Any way to delay CE String parse order?

Support (Resolved)

Brainwrek
Brainwrek

I’m using the Super Search module from Solspace.  That module includes a variable that prints the keywords for any given search: {super_search_keywords}

I’m going to include those keywords in the <title> of my document.  But I want to print them in uppercase using CE String like so:

<title>{exp:ce_str:ing strtoupper}{super_search_keywords}{/exp:ce_str:ing}</title

The desired output is: <title>THE ENTERED KEYWORDS</title>

Problem is the code prints this instead: <title>{SUPER_SEARCH_KEYWORDS}</title>

Obviously I need to run CE String after the Super Search tag is parsed.

Any ideas how I might accomplish this?

Thank you.

 

Brainwrek
# 1
Brainwrek

Stop the presses.  I just found a solution by mixing Croxton’s Stash add-on into the recipe.

Perhaps there is a better/simpler (CE String based) approach?  But this is working for me at the moment:

{exp:stash:set parse_tags="yes"}
{exp
:super_search:results}
{stash
:stashed_keywords}{super_search_keywords}{/stash:stashed_keywords}
{
/exp:super_search:results}
{
/exp:stash:set}

<title>{exp:ce_str:ing strtoupper}{exp:stash:get name='stashed_keywords'}{/exp:ce_str:ing}</title

On a side note, I’m amazed at how powerful CE String is.  I probably understand less than 1% of what it can do, but I’m rather wowed by it already.

Thanks Aaron.

Causing Effect - Aaron Waldon
# 2
Developer
Causing Effect - Aaron Waldon

Hi Brainwrek!

Yeah, using CE String by itself would normally just work, but I believe Super Search doesn’t follow the normal parse order. If it were a global variable, that variable would parse as expected. I’m happy to see you found a good workaround though. :)

MajesticIX
# 3
MajesticIX

Looking for a similar solution, just without using Stash. Any suggestions?

{exp:ce_str:ing strtolower}{structure:page_title_for:3}{/exp:ce_str:ing}

Does not work with Structure Global Variables.

Causing Effect - Aaron Waldon
# 4
Developer
Causing Effect - Aaron Waldon

Hi MajesticIX,

It would work as expected with most of Structure’s Global Variables. The “global variables” where structure is actually accepting a number as a parameter are actually parsed after the template is rendered. The only way to get that value would probably be to use Stash or CE Variables to pre-parse the value (which isn’t ideal, as it is essentially an embed).

Quick note: CE String does not control EE’s parse order. The EE parser takes care of that. Stash, CE Vars, and the like do their own processing.

MajesticIX
# 5
MajesticIX

Gotcha, thanks for the ultra fast reply and additional information…always good to know. I’ll just pop that into Stash then and call it a day. Thx!

MajesticIX
# 6
MajesticIX

I cheated and just used EE native:
{exp:channel:entries entry_id=“3” dynamic=“no”}{title}{/exp:channel:entries}

:P

5BYFIVE
# 7
5BYFIVE

I see you found a solution, but wouldn’t it just be easier to do it with CSS?

text-transform: uppercase

Edit: oops, just noticed you’re talking about the <title> and not another html element…nevermind!