From so long facing this issue, don't getting the result if I pass the php variable inside exp:channel's as paramater, I have mentioned the code below.

$entryId = "1";
$entryId = "1|2|3";

{exp:channel:entries entry_id='<?=$entryId?>'}
        <p>Page {current_page} of {total_pages} pages {pagination_links}</p>

I would love to allow both of them, One of these atleast. But as of now in my case none of these is working. it didnt accept PHP variable, and returns null or blank. If I write directly like this
entry_id="1" OR entry_id="1|2|3",
that will work perfect. and returns the entries and I've print the title of entry, So got the results.
And Yes I have allow PHP in my template from preference.
Can anybody find what I am making mistake in this..??

Please to help me, its such a irritating issue for me now.. I am open make any kind of changes.
All of suggestions will be allowed..

Thanks in Advance

Update :

Sir, Here I am not passing the segment, its a php form submit. So, I got the data in php $_POST Variable, I have used that in sql query[i.e. simple basic code like mysql_query and mysql_fetch_array]. I used this code, becuase of the same problem, I am not getting PHP variable inside exp:channel. Otherwise I like to use that {exp:query sql="..."}. Now what should I do.?? In actual its a result of search criteria. In form I have lots of fields with check box, whatever checkbox are checked that will be pass in from post, N here I got the result in $_POST variable[those are channel's fields], and need to pass that $_POST data and then what result i got on the base of channel's fields that is entries that will be display.

  • Please, forgive me for the dumb question. What is the stage parsing you chose to PHP? Input or output?
    – Sobral
    Commented Sep 2, 2013 at 14:48
  • Robson its output.. I think you will try to suggest me to select it as input then look at result, right..?? Ok Let me make it as input..
    – jt.
    Commented Sep 3, 2013 at 7:17
  • Hey Robson, Thanks Man.. Its working now.. I didnt know about that.. Thank you so much.
    – jt.
    Commented Sep 3, 2013 at 7:29
  • I added an answer. Please, mark it as right for help other people who has the same problem. Thanks!
    – Sobral
    Commented Sep 3, 2013 at 12:21

2 Answers 2


If you want to make your PHP variables available to the EECMS template language, make sure you set the PHP stage parsing to input, so the PHP will be parsed before all the template stuff.


Try a different approach using segment variables.

Or, if you want a list of entry ids, wrap the channel entries tag in the query module

{exp:query sql="SELECT GROUP_CONCAT(entry_id) AS entry_ids FROM exp_channel_titles WHERE ...put your conditions here..."}
{exp:channel:entries channel="news" entry_id="{entry_ids}" limit="10"}

Php in templates is not recommended.

Update: ok, so you have a search form and want to display entries, try dynamo or stash bundle. Youll need to do some reading.

FYI. I originaly used dynamo. Then wanted it to do more, so altered the source code. Then switched to stash bundles.

  • I also suggest you set aside a couple of hours to sit and read the user guide. It will help a lot.
    – Lloyd Hill
    Commented Sep 2, 2013 at 12:40
  • I have update my question.. please to read that..
    – jt.
    Commented Sep 2, 2013 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.