We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17399
    • 4 Posts
    Hi,

    I am using the method exposed in the following post: http://modxcms.com/forums/index.php?topic=40053.0 in order to edit my template in my favorite text editor.

    I am running modx localy on MAMP but the pages are not being included.
    It works fine when I copy the code directly into the chunck code.

    Modx version 2.1.1
    Server: localy running on MAMP
    Here are the snippet and chunck used to include the page site_header.html stored in /assets/templates/notorious

    Snippet name = includeTemplate
    <?php
    # Snippet to include template files from file system
    # USAGE: [[includeTemplate? &tpl=’mytemplate/template.html’]]
    
    if ( !isset($tpl) || $tpl== "" ) return "Missing Template file!";
    
    $tpl = $base_path.'assets/templates/'.$tpl;
    ob_start();
    include($tpl);
    return ob_get_clean();


    Chunk name = site_header

    [[includeTemplate? &tpl=`notorious/site_header.html`]]


    Is there any problem with MAMP because of $base_path?
    Is this methods working with 2.1.1?

    By the way is it expected that the closing php tag ?> disappears from the snippet when saving it? I though that was the cause of my problem but I get the same issue both in FF and Safari.

    Thanks for your input.

    Loic
      • 17399
      • 4 Posts
      i actually solved it changing the typo of the apostrophes in the snipet rewriting it on my own