Jump to:

10990 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » Newletter template issue

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1040 Views
  • servalman
    Avatar
    Community Member
    211 Posts

    Newletter template issue Link to this post

    Hello

    I'm running silvertstripe 2.3.3 with newsletter trunk "newsletter-trunk-r88195.tar.gz"
    I did manage to install it, have some contact list etc.

    My main problem like lots of people here is tog get the template system to work.

    I try follow the http://doc.silverstripe.com/doku.php?id=modules:newsletter instruction but I don't get :

    1) where _config.php is located (is it the main one or the one in the newsletter folder)
    2) when I try to add those two line :
    Email::setAdminEmail(’<default from address>’);
    Object::useCustomClass(”Member”, “<custom member classname>”);

    and flush I get a blank page. (in both _phpconfig files)

    I'm very stuck by all this, and it seems more complicated than using templates in Silvestripe itself ;)

    Can anyone show me a way of proceding or direct me to a post answering thos question (eventough I search the forums but did not find anything that halped me a lot)

    Thanks in advances

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Newletter template issue Link to this post

    1) Doesn't matter, but it's better to put your custom code in mysite/_config.php
    2) That's because you copy/pasted it from the docs and the quotes are wrong there. Should be:

    Email::setAdminEmail('<default from address>');
    Object::useCustomClass('Member', '<custom member classname>');

  • servalman
    Avatar
    Community Member
    211 Posts

    Re: Newletter template issue Link to this post

    Hi thanks for the answer .

    But when I try to add thos two line and flush I get a blank page as a result of flush not the usual list of database field and all

    Maybe it has to be inserted somewhere specific inside the _phpconfig file.

    Let me know.

    Thanks Again

    T

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Newletter template issue Link to this post

    There's no such thing as a _phpconfig file. It's _config.php.
    When you're getting a blank page, you most likely have an error in your code somewhere. Check the PHP error log to find out where.

  • servalman
    Avatar
    Community Member
    211 Posts

    Re: Newletter template issue Link to this post

    OUps sorry I meant _config.php

    Anyway I was wonedring where to put those two lines in the _config.php file

    I did it like this but it is not working (blank page after flush)

    Any advice Thanks

    <?php

    global $project;
    $project = 'mysite';

    global $databaseConfig;
    $databaseConfig = array(
       "type" => "MySQLDatabase",
       "server" => "localhost",
       "username" => "xxxxxx",
       "password" => "xxxxxx",
       "database" => "xxxxxx",
    );

    // Sites running on the following servers will be
    // run in development mode. See
    // http://doc.silverstripe.com/doku.php?id=devmode
    // for a description of what dev mode does.
    Director::set_dev_servers(array(
       'localhost',
       '127.0.0.1',
    ));

    // This line set's the current theme. More themes can be
    // downloaded from http://www.silverstripe.com/themes/
    SSViewer::set_theme('blackcandy');

    // set email template folder to themes/mytemplate/templates/email
    NewsletterAdmin::$template_path = "themes/mytemplate/templates/email";

    // Newsletter set up
    Email::setAdminEmail('<default from address>');
    Object::useCustomClass('Member', '<custom member classname>');
    ?>

    T

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Newletter template issue Link to this post

    Like I said: If you get a blank page, there's probably an error in your PHP code somewhere. Check the PHP error log.

  • servalman
    Avatar
    Community Member
    211 Posts

    Re: Newletter template issue Link to this post

    Thanks I did check and corrected the php mistake ( some quote problem)

    Now I have another problem I followed the instruction for the template settings and I ca not get it to appear in the dropdown menu .

    My _config.php is in mys site and is set like this :

    <?php

    global $project;
    $project = 'mysite';

    global $databaseConfig;
    $databaseConfig = array(
       "type" => "MySQLDatabase",
       "server" => "localhost",
       "username" => "xxxxx",
       "password" => "xxxxx",
       "database" => "xxxxx",
    );

    // Sites running on the following servers will be
    // run in development mode. See
    // http://doc.silverstripe.com/doku.php?id=devmode
    // for a description of what dev mode does.
    Director::set_dev_servers(array(
       'localhost',
       '127.0.0.1',
    ));

    // This line set's the current theme. More themes can be
    // downloaded from http://www.silverstripe.com/themes/
    SSViewer::set_theme('blackcandy');

    // set email template folder to themes/mytemplate/templates/email
    NewsletterAdmin::$template_path = "themes/mytemplate/templates/Email";

    // Newsletter set up
    Email::setAdminEmail('<default from address>');
    Object::useCustomClass('Member', '<custom member classname>');
    ?>

    my pemplate is in themes/mytemplate/templates/Email and is like this

    CAn you tell me if all this is corect, maybe I missed something

    Thanks for your time and help

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>

    <head>
    <style>
    ...
    </style>
    </head>
    <body>

    <h1><img src="http://www.mysite.com/images/image.png" alt="My Image" /></h1>

    <div class="body">
    <p>Dear $Member.FirstName,</p>
    $Body
    </div>

    </body>
    </html>

    T

  • servalman
    Avatar
    Community Member
    211 Posts

    Re: Newletter template issue Link to this post

    It's working !

    I was rtying to change the template folder

    Thanks a lot

    1040 Views
Page: 1
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.