Topic Closed
a2exfr
242 Posts
24.5K Downloads
2 Themes
10 Plugins

Hi.

How is possile to check, if the extra content file is empty?

For checking, if  file some.php exist in data\_extra I use file_exists,  but I need to check, if  no content in it.

$extra_content = array (
  'content' => ' ',

 

p.s. sorry for my English

Edited: 4 years ago#7330

a2exfr
242 Posts
24.5K Downloads
2 Themes
10 Plugins

it"s work

global $dataDir, $dirPrefix;

$line = file_get_contents($dataDir.'/data/_extra/some.php');

    if(preg_match_all("/'content' => ''/", $line, $mathes)

but I thought, that I should use some gpEasy function

Edited: 4 years ago#7331

juergen
1.4K Posts
51.3K Downloads
16 Plugins
design, web development & visual effects

Not exactly an answer to your question but in case you want to make even empty areas editable, this is a very simple solution:

Insert

body.gpAdmin div.editable_area {
  min-height:1em!important;
}

… into your theme stylesheet.

When you are logged in, this will render even empty areas at least 1 line high, thus makes them selectable.

4 years ago#7332

juergen
1.4K Posts
51.3K Downloads
16 Plugins
design, web development & visual effects

this would be safe to paste in your template.php:

<?php 
  if ( common::LoggedIn() ) {
    global $dataDir;
    $extraAreas = gpFiles::ReadDir( $dataDir . '/data/_extra' );
    $emptyAreas = array();
    foreach ( $extraAreas as $key => $val ) {
      $area = gpOutput::ExtraContent( $val );
      $type = $area['type'];
      $content = trim( $area['content'] );
      $content =  str_replace( '&nbsp;', '', $content );
      if ( empty( $content ) ) {
        $emptyAreas[] = array( $key => $type );
      }
    }
    message("Empty ExtraAreas: " . showArray( $emptyAreas ) );
  }
?>

Hope that helps

/edit: including the red stuff could even flag areas as empty that contain possible whitepsace leftovers.

Edited: 4 years ago#7333

a2exfr
242 Posts
24.5K Downloads
2 Themes
10 Plugins

Thanks, for help!

I miss

gpOutput::ExtraContent( )
4 years ago#7334

juergen
1.4K Posts
51.3K Downloads
16 Plugins
design, web development & visual effects

You're welcome!
BTW: Slick idea to use Extra Content for Slides! Have not yet thought of this solution.

FYI: I currently use included pages with sections as slides to accomplish that
e.g. see -> http://wasserautomaten.berlin 
and the resource page -> http://wasserautomaten.berlin/Slideshow_01

Has some advantages (e.g. sections can be reordered, section types can be forced to a specific size, slides can be set inactive via section options) but it's more cumbersome to implement.
I have called it "SliderFactory" but unfortunately it's not yet ready for publishing. Still needs some UX work to make it usable.
But I'm willing to share code if you are interested.

4 years ago#7340

a2exfr
242 Posts
24.5K Downloads
2 Themes
10 Plugins
Of course , it is interesting.   If you do not mind, I would have looked.
4 years ago#7343

juergen
1.4K Posts
51.3K Downloads
16 Plugins
design, web development & visual effects

> Of course , it is interesting.

It's all in german language at the moment. I'll post a link shortly - will have to make it up a liltte.
 

Edited: 4 years ago#7345

juergen
1.4K Posts
51.3K Downloads
16 Plugins
design, web development & visual effects

Sorry for the delay. I promised to post my SliderFacory Plugin here a month ago. But as you know, the new Wrapper Sections give us so much more control over the content that my current way to include a page containig the slides is outdated.
Once the new Section Combos are set in stone, a slideshow content type with fully editable slides will surely be one of my first projects.
 

4 years ago#7580

Topic Closed

 

News

Typesetter 5.1
8/12/2017

Typesetter 5.0.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read More

Over 8 Times Faster Than Wordpress
5/3/2016

We've known for a long time that Typesetter is fast. It's something we take pride ... Read More

More News

creisi productions

Dienstleistungen von creisi productions, Luzern (Schweiz): * Konzeption, Planung und Erstellung Ihres Internet-Auftritts * Betreuung und Aktualisierung/Pflege Ihrer Website * ...

Find out more about our Provider Spotlight

Log In

  Register