Jump to content

Archived

This topic is now archived and is closed to further replies.

bluecloud

Output linebreaks

Recommended Posts

bluecloud    3
bluecloud

In a custom section I have a textarea option. When I enter some text in the textarea and do some linebreaks, I see them in the DMS editor, but they are gone on the output.

 

How do I keep these linebreaks on the output? I have now:

function section_template() {
    printf( '
            <div class="row">
                <div class="span4">%1$s</div>
                <div class="span6"><p>%2$s</p></div>
            </div>',
            $this->build_menu(),
            $this->opt( 'my_text' ), // This my textarea 
           
   );
}

Share this post


Link to post
Share on other sites
Danny    1,327
Danny

Hi,

 

Can you add your whole custom sections code (full section.php file) to your reply, so I can try myself please.

 

Also, try viewing our developer docs which has information on how to add text areas etc. - http://docs.pagelines.com/developer/dms-option-engine

 

Like so:

 

$opts[] = array(
            'key'           => 'some_key',
            'type'          => 'textarea', 
        );

Please search our forums, before posting!

Share this post


Link to post
Share on other sites
bluecloud    3
bluecloud

Here it is:

<?php
/**
Section: Sub Header
Author: Blue Cloud
Author URI: http://www.bluecloudcompany.com
Description: Een subheader met daarin een menu en een tekstblok
Version: 1.0.0
Class Name: EGS_SubHeader
Filter: Component
*/


class EGS_SubHeader extends PageLinesSection {


    function section_persistent() {

        // Put code that should always be loaded here.
        $url = $this->base_url; // the base url of the section
        $dir = $this->base_dir; // the base directory of the section

    }




    function section_opts() {

        $opts = array(
            array (
                'key'           => 'subheader_menu',
                'type'          => 'select_menu',
                'title'         => __('Sub Menu', 'erfgoedspoor'),
                'label'			=> __( 'Selecteer menu', 'erfgoedspoor' )
            ),
            array(
				'key'			=> 'subheader_title',
				'type'			=> 'text',
                'title'         => __( 'Titel', 'erfgoedspoor'),
				'label'			=> __( 'Titel in de Sub Header', 'erfgoedspoor' ),
            ),
            array(
				'key'			=> 'subheader_text',
				'type'			=> 'textarea',
                'title'         => __( 'Tekstblok', 'erfgoedspoor'),
				'label'			=> __( 'Tekst in de Sub Header', 'erfgoedspoor' ),
            ),
        );
        return $opts;

    }



    function section_styles() {

    }



    function section_head(){

        // This will out put in between your sites <head> tags.
        // For example, adding javascript:
        ?>
        <script>
            jQuery(window).ready(function() {
                // Javascript could go here.
            });
        </script>
        <?php

    }




    function section_template() {

        printf( '
            <div class="row">
                <div class="span4">%3$s</div>
                <div class="span6 subheader-text"><h5>%2$s</h5><p>%1$s</p></div>
            </div>',
            $this->opt( 'subheader_text' ),
            $this->opt( 'subheader_title' ),
            $this->build_menu()
        );

    }


    /**
     * Build the menu
     * @return string
     */
    private function build_menu( ) {

        $menu = $this->opt( 'subheader_menu');
        $menu_list = '';
        $menu_items = wp_get_nav_menu_items( $menu );

        $menu_list .= '<ul class="subheader-menu unstyled">';

        foreach( (array)$menu_items as $menu_item ) {

            $title = $menu_item->title;
            $url = $menu_item->url;
            $menu_list .= '<li><a class="" href="'.$url.'">' . $title . '</a></li>';

        }

        $menu_list .= '</ul>';

        return $menu_list;
    }





}

Share this post


Link to post
Share on other sites

  • Similar Content

    • oseehys
      By oseehys+
      Hello There,
      So i want to use platform 5 and DMS sections on a single page, i am using a child theme with pinspro as my main theme and i activated platform 5, the only problem am having so far is the fixed option, my navbars are not aligning to their default size, and it will be great if platform 5 header and footer section will function, has anyone used this option, how can i make the best use of platform 5 and DMS on a site
      Cheers
    • yemoonyah
      By yemoonyah+
      Hi,
      I tried to make a simple change on my opt-in page today by reordering two sections.
      Now they won't save and whatever I do, the same 2 section will be stuck to the top.
      This is a huge problem since it is my opt-in page!
      http://yemoonyah.com/quiz
      (I'm on the latest WP & PL version)
      Thanks.
       
    • Anthony King
      By Anthony King+
      I have to say that I like the Layout and the Template based sections. Some of them are really impressive.
      One of the things that I would like to request though is the possibility of being able to dynamically rearrange the layout.
      An example of what I am talking about is take the Agency Section. It's current layout starts with the
      Splash Module then the Portfolio Module then the Service Module and so on and so forth.
      What would be great is if we were able to move these modules around. I.e have the Service Module first
      then maybe the Splash, and then the portfolio.
       
    • nandorj78
      By nandorj78+
      This discussion has appeared today on the Facebook User Group and we decided to have a vote to know what the users judge more important.
      Let me know which questions you want me to add to the poll.
    • chrisayers
      By chrisayers+
       
      Post Deleted...

×