Add new External Pages

Recently, I wrote a tutorial on how to add new external pages to Elgg, other than the three comes by default.

http://ishouvik.tk/add-new-external-pages-elgg-trick

 

Anyone who is interested in expanding the external pages, could go through this.

  • I followed Shouvik Mukherjee's (thanks for your tutorial by the way) steps in Elgg 1.8.0, but ran into an issue.  Externalpages in Elgg 1.8.0 doesn't have:\mod\externalpages\views\default\expages\footer_menu.php\  the footer_menu.php was actually incorperated into externalpages start.php for 1.8so if you are running 1.8 and are getting irritated that your pages aren't showing up or aren't working,  here is the modification with respect and steps by Shouvik Mukherjee  :

    1) Open this directory – \mod\externalpages\languages\en.php\ and seek the following line-
    ‘expages:privacy’ => “Privacy”,
    Add the following code after this line-
    ‘expages:yourpagename’ => “yourpagename”,

    2) Open this directory – \mod\externalpages\start.php and seek the following line-
    function expages_setup_footer_menu() {
        $pages = array('about', 'terms', 'privacy'); which starts on line 30
    Add the following code after this line-
    function expages_setup_footer_menu() {
        $pages = array('about', 'terms', 'privacy', 'yourpagename');

     

    3) Open this directory – \mod\externalpages\views\default\expages\menu.php\ and seek the following line-
    <li <?php if($type == ‘privacy’) echo “class = ‘selected’”; ?>><a href=”<?php echo $url; ?>privacy”><?php echo elgg_echo(‘expages:privacy’); ?></a></li>
    Add the following code after this line-
    <li <?php if($type == ‘yourpagename’) echo “class = ‘selected’”; ?>><a href=”<?php echo $url; ?>yourpagename”><?php echo elgg_echo(‘expages:yourpagename’); ?></a></li>

     

    4) Open this directory – \mod\externalpages\views\default\expages\forms\edit.php\ and seek the following line-
    else if($type == ‘privacy’) {
    $external_page_title = elgg_echo(‘expages:privacy’);
    }
    Add the following code after this line-
    else if($type == ‘yourpagename’) {
    $external_page_title = elgg_echo(‘expages:yourpagename’);
    }


    5) Save all files and upload the modified plugin.

     

    6) Then, run the upgrade.php script by hitting http://SITEURL/upgrade.php in address-bar.


  • Sorry, I had to rewrite the steps,  I apologize people, here are the proper steps for 1.8:

     

     

    1) Open this directory – \mod\externalpages\languages\en.php\ and seek the following line-
    ‘expages:privacy’ => “Privacy”,
    Add the following code after this line-
    ‘expages:yourpagename’ => “yourpagename”,

    2) Open this directory – \mod\externalpages\start.php:

    ·         Copy:  elgg_register_page_handler('privacy', 'expages_page_handler'); hit enter and paste right below it and chang “privacy” to your page name

    ·         Scroll down to line 32 and edit:
    function expages_setup_footer_menu() {
        $pages = array('about', 'terms', 'privacy');

    to look like:
    function expages_setup_footer_menu() {
        $pages = array('about', 'terms', 'privacy', 'yourpagename');

     

    3) Open this directory – \mod\externalpages\views\default\expages\menu.php\ and seek the following line-
    <li <?php if($type == ‘privacy’) echo “class = ‘selected’”; ?>><a href=”<?php echo $url; ?>privacy”><?php echo elgg_echo(‘expages:privacy’); ?></a></li>
    Add the following code after this line-
    <li <?php if($type == ‘yourpagename’) echo “class = ‘selected’”; ?>><a href=”<?php echo $url; ?>yourpagename”><?php echo elgg_echo(‘expages:yourpagename’); ?></a></li>

     

    4) Save all files and upload the modified plugin.

     

    5) Then, run the upgrade.php script by hitting http://SITEURL/upgrade.php in address-bar.

  • Here is a question, how do you edit these new pages in admin, because newly added pages don't show up in admin section.

  • @fareed, if you are running Elgg 1.8, and you followed my second step post,  then in admin under appearence is "site pages"  and that is where you edit all the externalpages.  Hope this answered your question.

     

  •  

     

     

    Que tal..

    como agrego contenido o texto a las paginas externas del sitio. External Pages

    no enlaces…contenido, ya que no he podido hallar esas rutas….

    Gracias

     

    How about ..
    or text and add content to pages outside the site. External Pages
    no links ... content, I could not find those routes ....
    thanks

     

     

  • @ Lucius Beach, in step 3 of your instructions, i don't see the code you listed in my file. here is the code that's in my \mod\externalpages\views\default\expages\menu.php\ file:

     

     

    <?php
    /**
     * External pages menu
     *
     * @uses $vars['type']
     */

    $type = $vars['type'];

     //set the url
     $url = $vars['url'] . "admin/site/expages?type=";
     
    $pages = array('about', 'terms', 'privacy');
    $tabs = array();
    foreach ($pages as $page) {
        $tabs[] = array(
            'title' => elgg_echo("expages:$page"),
            'url' => "admin/appearance/expages?type=$page",
            'selected' => $page == $type,
        );
    }

    echo elgg_view('navigation/tabs', array('tabs' => $tabs, 'class' => 'elgg-form-settings'));

     

    I don't understand what to do with this

  • rohonupe99

    I had same issue and was playing around with code: This worked, although I would not trust my code 100% (Make backup menu file etc.)

    $pages = array('about', 'terms', 'privacy,');

    I simple added the page I was working on:

    $pages = array('about', 'terms', 'privacy', 'instructions,');

    and that seemed to work fine...

     

  • that worked Solcjoye. That's a lot!

  • After doing this and in admin section when I added about us, I am getting this code showing up and can't delete it or get rid of it in any way.


    <!--[if gte mso 9]>

    Normal
    0

    false
    false
    false

    MicrosoftInternetExplorer4

    <![endif]--><!--[if gte mso 9]>

    <![endif]--><!--[if gte mso 10]>

    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Times New Roman";
    mso-ansi-language:#0400;
    mso-fareast-language:#0400;
    mso-bidi-language:#0400;}

    <![endif]--><!--[if gte mso 9]>

    Normal
    0

    false
    false
    false

    MicrosoftInternetExplorer4

    <![endif]--><!--[if gte mso 9]>

    <![endif]--><!--[if gte mso 10]>

    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Times New Roman";
    mso-ansi-language:#0400;
    mso-fareast-language:#0400;
    mso-bidi-language:#0400;}

    <![endif]-->

  • @fareed:

    I believe you inserted the content for the page via copy+paste from MS Word. Am I right? What version of Elgg are you using (I'm guessing some Elgg 1.7.X)? More importantly what version of tinymce? Because the problem is caused by a bug in older versions of the tinymce editor that is used within the tinymce plugin. In Elgg 1.7 the bug is included in tinymce while Elgg 1.8 should include a more recent tinymce release.

    To get rid if the characters open the source code view ("HTML"). You should be able to remove the unwanted characters there.

    To avoid it happen again you should upgrade tinymce. If you can't or don't want to upgrade to Elgg 1.8 you can either download the latest release of the tinymce editor from http://www.tinymce.com/index.php and replace the files in the tinymce plugin folder. My Extended tinymce plugin also has the latest version included: http://community.elgg.org/pg/plugins/project/715175/developer/iionly/elgg-17-extended-tinymce-347 for Elgg 1.7 or http://community.elgg.org/pg/plugins/project/782028/developer/iionly/elgg-18-extended-tinymce-347 for Elgg 1.8.