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.

PRINTING and Echo IN EE

July 10, 2007 6:16pm

Subscribe [2]
  • #1 / Jul 10, 2007 6:16pm

    eeuser

    10 posts

    Hi!

    How can I print .echo out a simple PHP rpint statement using ee template.

    It seem to to take php code, but it wont print .

    for example I am trying to echo ” authors $authors
    “; in EE


    Any sugestion why it wont print out the value?

  • #2 / Jul 10, 2007 6:23pm

    ms

    274 posts

    Enable PHP in the setting for the template and use:

    <?php echo " authors $authors
    "; ?>

    somewhere inside your template (assuming you have set $authors somewhere before).

  • #3 / Jul 10, 2007 6:42pm

    eeuser

    10 posts

    Thanks That worked.

    I am also trying to search different catgories based on regions, authors and by topic from a combo box.

    Authors     Regions     Topics
    =======    ========    ===========
    Auth1 |    |Reg1 |    |  Topic1 |
    Auth2 |    |Reg2 |    |  Topic2 |
    Auth3 |    |Reg3 |    |  Topic3 |
    =======    ========    ===========
    I have 3 combobox one for regions, one for authors and one for topics to search from the categories. or they can select a author , a region or a topic etc


    Is there anyway to search them based on the above ? This is my code below( right now it returns all.


    <?php
    // Add * before query strings so that STRPOS will never return a 0 which might be interpreted as false when actually the string was found.
    {!--
    $authors = '*' . $_REQUEST['authors'];
    $regions = '*' . $_REQUEST['regions'];
    $topics = '*' . $_REQUEST['topics'];
    --}
    $authors = ‘All’;
    $regions = ‘All’;
    $topics = ‘All’;
    $empty=true;


    echo ” Author: $authors
    Regions: $regions
    Topics : $topics
    “;

    //set cookies for back button
    $auth = str_replace(array(’*’), “”, $authors);
    $regn = str_replace(array(’*’), “”, $regions);
    $topc = str_replace(array(’*’), “”, $topics);
    setcookie(“authorCookie”, $auth, time()+3600);
    setcookie(“regionCookie”, $regn, time()+3600);
    setcookie(“topicCookie”, $topc, time()+3600);
    ?>

    {exp:weblog:entries category="4|5|15" limit="10" paginate="both"}


    <a href=“http://{global_server_name}/entry/{entry_id}”>{title} <a> {author} {entry_date format="%F %d %Y"}

     

    {paginate}
    Page {current_page} of {total_pages} pages {pagination_links}
    {/paginate}

    {/exp:weblog:entries}

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

ExpressionEngine News!

#eecms, #events, #releases