Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

Newletter template issue


Go to End


8 Posts   1480 Views

Avatar
servalman

Community Member, 211 Posts

21 October 2009 at 11:01pm

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

Avatar
bummzack

Community Member, 904 Posts

21 October 2009 at 11:47pm

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>'); 

Avatar
servalman

Community Member, 211 Posts

22 October 2009 at 1:02am

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

Avatar
bummzack

Community Member, 904 Posts

22 October 2009 at 2:04am

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.

Avatar
servalman

Community Member, 211 Posts

22 October 2009 at 8:11pm

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

Avatar
bummzack

Community Member, 904 Posts

22 October 2009 at 9:06pm

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

Avatar
servalman

Community Member, 211 Posts

22 October 2009 at 9:53pm

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

Avatar
servalman

Community Member, 211 Posts

22 October 2009 at 10:44pm

It's working !

I was rtying to change the template folder

Thanks a lot