Title: php echo inside $output
Last modified: August 20, 2016

---

# php echo inside $output

 *  [rize](https://wordpress.org/support/users/rize/)
 * (@rize)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/php-echo-inside-output/)
 * 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.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/php-echo-inside-output/#post-2569893)
 * Try using:
 * `<?php echo getPageContent(8);?>`
 *  Thread Starter [rize](https://wordpress.org/support/users/rize/)
 * (@rize)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/php-echo-inside-output/#post-2569930)
 * thanks but that didn’t work too. any other option?
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/php-echo-inside-output/#post-2569939)
 * if `getPageContent(8)` returns a string of some sort, try string concatenation;
 * example:
 *     ```
       ...
       <div id="hometabs">
       HTML;
       $output .= getPageContent(8);
       $output .= <<<HTML
       	</div>
       ...
       ```
   
 *  Thread Starter [rize](https://wordpress.org/support/users/rize/)
 * (@rize)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/php-echo-inside-output/#post-2570014)
 * thanks but that didn’t work too.. what could be wrong.?
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/php-echo-inside-output/#post-2570058)
 * 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?

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘php echo inside $output’ is closed to new replies.

## Tags

 * [page](https://wordpress.org/support/topic-tag/page/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 3 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/php-echo-inside-output/#post-2570058)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
