ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Can You Instantiate a PHP Variable Within an EE Entries Tag?

December 21, 2011 11:51am

Subscribe [3]
  • #1 / Dec 21, 2011 11:51am

    wiley

    37 posts

    I want to instantiate a PHP variable with some custom field values. Then I want to use this PHP variable is some custom PHP code that’s to be executed on Output.  Pseudo-coding, is the below sort of thing possible?  Or, if not, does anyone have a suggestion for how to cull this data so it’s available for my custom PHP?

    {exp:weblog:entries weblog="course" limit="1"}
      <!php $newvar = 
        {reverse_related_entries weblog="class"}
          {class_id}
        {/reverse_related_entries}
      ?>
    {/exp:weblog:entries}

    Then, I’d like to use $newvar in some custom PHP that would follow.

  • #2 / Dec 22, 2011 2:21am

    John Henry Donovan

    12339 posts

    Hi wiley,

    In theory you could use an embed here with yoru weblog entries tag inside the embed

    <?php 
    $newvar = "{embed="includes/course-entries}";
    ?>

    Does that help?

     

  • #3 / Aug 09, 2012 11:29am

    wiley

    37 posts

    JHD, thanks for that suggestion! This particular issue got buried in long to-do list, but I’ll keep this approach in mind for the future.  Much appreciated!

  • #4 / Aug 09, 2012 12:13pm

    John Henry Donovan

    12339 posts

    No problems

  • #5 / Aug 10, 2012 10:20am

    Shane Eckert

    7174 posts

    Hey wiley,

    I am glad to see that John was able to help!

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases