Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » newsletter template path

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 2691 Views
  • Mad_Clog
    Avatar
    Community Member
    78 Posts

    Re: newsletter template path Link to this post

    Did you even read my posts?
    That's the exact location i told you to put them in.
    *shrug*

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: newsletter template path Link to this post

    I'm sorry I missed where you put them too Mad_Clog but this makes more sense now. The way the module is written it should function with the templates placed in your themes dir but right now that part seems to be broken. Could you test that?

    Just move your email templates to templates/email or templates/Email and flush. If you end up with an empty list then the issue is there for you too. Lucky for us that it checks the project dir as well.

  • firstpixel
    Avatar
    Community Member
    16 Posts

    Re: newsletter template path Link to this post

    My problem was that in the newsletter section in the admin I couldn't select my template, no matter where I put the files. That's why I had to input the template name into the database directly and then it worked with the path of Mad_Clog.

    Greetings!

  • flozwo
    Avatar
    Community Member
    5 Posts

    Re: newsletter template path Link to this post

    Hi
    file: NewsletterAdmin.php line: 480

    there need an array.
    in time $paths is a string, but it must an array

    $paths = self::template_paths();

    $paths[] = self::template_paths();

       public function templateSource(){
          $paths[] = self::template_paths();
          //$paths = "/themes/hshl/templates/email";
          
          $templates = array( "" => _t('TemplateList.NONE', 'None') );

          if(isset($paths) && count($paths)){
             $absPath = Director::baseFolder();
             if( $absPath{strlen($absPath)-1} != "/" )
                $absPath .= "/";

             foreach($paths as $path){
                $path = $absPath.$path;
                if(is_dir($path)) {
                   $templateDir = opendir( $path );

                   // read all files in the directory
                   while( ( $templateFile = readdir( $templateDir ) ) !== false ) {
                      // *.ss files are templates
                      if( preg_match( '/(.*)\.ss$/', $templateFile, $match ) ){
                         $templates[$match[1]] = $match[1];
                      }
                   }
                }
             }
          }
          return $templates;
       }

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: newsletter template path Link to this post

    flozwo - sounds like thats a bug? Perhaps submit the fix to the github repo (you can edit a file inline in the github repo if you don't have time to submit via git).

  • Mauro74
    Avatar
    Community Member
    30 Posts

    Re: newsletter template path Link to this post

    Talking about templates, is it possible to use the draft as an editable zone in the template? Something like:

    <table>
    <tr>
    <td>
    Hello
    </td>
    <td>
    this is a
    </td>
    <td>
    newsletter
    $Content
    </td>
    </tr>
    </table>

    Where $Content would be the content of the draft?

    2691 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.