WordPress.org

Forums

php echo inside $output (6 posts)

  1. rize
    Member
    Posted 3 years ago #

    I'm trying to get a specific page content from a page and i need to insert this php code:

    <?php echo getPageContent(8); ?>

    i tried this:

    $output .= <<<HTML
    
    			</div>
    		</div>
    <div id="hometabs">
    echo getPageContent(8);
    	</div>
    <div class="clear"></div>
    	</div>
    
    	<div class="bottom_shadow"></div>
    
    </div>
    HTML;

    but it doesn't work.. i even tried:

    getPageContent(8);
    echo getPageContent(8)

    still it didn't

    note: i already have code for the getPageContent i'm just not sure why when viewing on my browser, this code: echo getPageContent(8) shows up instead of executing it.

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Try using:

    <?php echo getPageContent(8);?>

  3. rize
    Member
    Posted 3 years ago #

    thanks but that didn't work too. any other option?

  4. if getPageContent(8) returns a string of some sort, try string concatenation;

    example:

    ...
    <div id="hometabs">
    HTML;
    $output .= getPageContent(8);
    $output .= <<<HTML
    	</div>
    ...
  5. rize
    Member
    Posted 3 years ago #

    thanks but that didn't work too.. what could be wrong.?

  6. can you post some code to put the snippet into context?

    possibly the code of the whole template?

    (please use the pastebin.com ... )

    I assume that <?php echo getPageContent(8);?> does output the right content?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags