Search
Other Conditional Content questions
Forum

Using PHP Script example but not getting desired result

Tim Myerson's Avatar Tim Myerson
Sorry, I have been a user of your excellent plugins for several years and you were my first call now that I need to create some dynamic content. I'm sure that I'm making a simple error, BUT something is wrong.

I need to display some simple wording only if a specific couple of words are present in an Article. I believe that using the
Assign to keyword (in page text Custom PHP Condition)
is the way go.

Using the 'Conditional Content Button' I generated the following to display the text if the string 'European Union' is present:
Confidential information:
(hidden)


Clearly the text string is present (line 2) BUT nothing displays.

What have I missed please?

I have just discovered that having set up the sample article page in question here:
Confidential information:
(hidden)
(this links to a 'Public page') that displays the additional scripting code. However, if you use either the LITE or PLUS login details provided to log in and then attempt to view the exact same page, that code is NOT displayed. Logout and then go to the page, the code is back!

I'm sorry, as I'm sure that it'll prove to be something that I have done (or not done) but I'd really appreciate some assistance in getting things working properly.

Thanks
Tim
Peter van Westen's Avatar Peter van Westen ADMIN
You can probably not use the document buffer code from there, as the articles are not fully rendered yet. So the buffer is still empty.

You would have to check the article content instead. But that won't work, as the article content also contains the Conditional Content code. So you are telling it to check for 'European Union', which will always be there, as it is in the {show} tag itself.
Please post a rating at the Joomla! Extensions Directory
Tim Myerson's Avatar Tim Myerson
Hi Peter

Many thanks for taking a look.

Your logic is inescapable, mine was flawed, not to worry, that's how we learn!

Many thanks for superb products.

All the best

Tim
Peter van Westen's Avatar Peter van Westen ADMIN
My pleasure ?
Please post a rating at the Joomla! Extensions Directory
Peter van Westen's Avatar Peter van Westen ADMIN
What might work is 'break' the search string.
Something like:
return str_pos($article->introtext, 'European' . ' ' . 'Union') !== false;
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription