WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.8 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Know when a page_content is not empty
  • Print
Pages: [1]   Go Down

Author Topic: Know when a page_content is not empty  (Read 7988 times)

Offline ledob44

  • Posts: 2
Know when a page_content is not empty
« on: August 05, 2010, 02: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: [Select]
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: [Select]
$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, 02:48:57 PM by ledob44 »
Logged

Offline LuuQ

  • Posts: 96
  • Gender: Male
Re: Know when a page_content is not empty
« 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

  • Guest
Re: Know when a page_content is not empty
« Reply #2 on: December 27, 2010, 12:59:08 AM »
See also https://forum.WebsiteBaker.org/index.php/topic,18231.msg121394.html#msg121394
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Know when a page_content is not empty
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2