Welcome, Guest. Please login or register.
Did you miss your activation email?
February 13, 2012, 02:20:02 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
149700 Posts in 21103 Topics by 7538 Members
Latest Member: ionline
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Know when a page_content is not empty  (Read 955 times)
ledob44

Offline Offline

Posts: 2


« on: August 05, 2010, 01:43:03 PM »

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

Code:
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 :

Code:
$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
« Last Edit: August 05, 2010, 01:48:57 PM by ledob44 » Logged
LuuQ

Offline Offline

Posts: 96



WWW
« Reply #1 on: December 24, 2010, 05:21:47 PM »

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
Logged
Argos
Moderator
**
Offline Offline

Posts: 2084


WWW
« Reply #2 on: December 27, 2010, 12:59:08 AM »

See also http://www.websitebaker2.org/forum/index.php/topic,18231.msg121394.html#msg121394
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!