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

Embed variable error - EE 5.3.2

Development and Programming

motoracer's avatar
motoracer
8 posts
5 years ago
motoracer's avatar motoracer

Hi,

I have such a record: {embed="core/template" meta_title="Lorem ipsum is dumny text"}

In the template file: <title>{if embed:meta_title == ''}Defualt text{if:else}{embed:meta_title}{/if}</title>

The code does not work. On another server, the same code works fine. The problem appeared suddenly. Did anyone meet something like that?

       
Robin Sowell's avatar
Robin Sowell
13,255 posts
5 years ago
Robin Sowell's avatar Robin Sowell

Everything looks good in your code. So- it was working, and suddenly broke? Is that the only thing that broke? If you have the ‘title’ bit with the embed variables on a template all by itself with nothing else, what’s it showing?

And double check PHP error logs. Let’s see if anything is weird there.

Oh- and it’s always worth very briefly disabling all extensions to make sure nothing is going weird there. But only briefly- it may break things.

       
motoracer's avatar
motoracer
8 posts
5 years ago
motoracer's avatar motoracer

If the meta_title = “” field passes empty then the default text is not displayed. It suddenly stopped working. Plugins turned off for a while but did not help.

Oddly enough, on another server I have the same code in another cms and it works fine there.

<?php $title = “{embed:meta_title}”; echo $title;?> <?php if($title == “”):?> <title>Default text</title> <?php else:?> <title>{embed:meta_title}</title> <?php endif;?>

The condition in php also doesn’t work. If the meta_title field is empty, it does not go further.

Additionally: <? php $ title = “{embed: meta_title}”; echo strlen ($ title);?> It returns 26 despite the empty string.

       
motoracer's avatar
motoracer
8 posts
5 years ago
motoracer's avatar motoracer

Problem solved.

meta_title=”{exp:low_variables:single var='default_site:lv_meta_title_{user_language}’ site=’default_site’}”,

With such a record it works fine. Why the short record does not work, I do not know.

       
Robin Sowell's avatar
Robin Sowell
13,255 posts
5 years ago
Robin Sowell's avatar Robin Sowell

It’s not making much sense to me, but I may not be fully understanding everything that was happening. The weirdest bit to me would be if it was working and suddenly broke. Something definitely had to have changed for that to happen, but there’s nothing I know of that would have jammed those embed variables.

Very odd!

       
motoracer's avatar
motoracer
8 posts
5 years ago
motoracer's avatar motoracer

For me this situation is also quite strange. At the moment I don’t know what could be the reason.

       
Robin Sowell's avatar
Robin Sowell
13,255 posts
5 years ago
Robin Sowell's avatar Robin Sowell

If there’s more weirdness, it may be worth signing up for a month of support and having us dig into it. It just sounds really odd and I don’t love it.

Fingers crossed, it’s a glitch and just solved itself.

       

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.

Advertisement
Advertisement