Know when a page_content is not empty

Argos

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

LuuQ

Oh dear!

You saved me an hour. Thank you very much for posting this. I was searching exactly for this piece of code. I just typed "page_content" in the search field of the forum and got your post. It's really exactly what I need.

And by the way, I think your English is alright!


Thanks again and best regards,

LuuQ

ledob44

#1
Hello, here's a little code to check if a wysiwyg page_content contains datas. I put it in the frontend.functions.php

function isPageContent($num){
ob_start();
page_content($num);
$content=ob_get_contents(); 
ob_end_clean();
if($content != ''){
return $content;
}else{
return false;
}
}


To use it :

$content = isPageContent(numberOfYouBlock);
if($content){
       echo '
          <div id="test">
               <h2>Promo</h2>
               '.$content.'
          </div>
        ';
}


It's very usefull when you have some html specific construction linked to a wysiwyg. Like that, webmaster don't have to put some extra code in the wysiwyg.

P.S : sorry for my english