SilverStripe default email style - silverstripe

Is it possible with SilverStripe 3 to create a default email template/style which is applied to all sent emails, without have to to override each email template separately?
Ideally this could be done as part of a theme.
I've tried defining a custom GenericEmail.ss template but it's been ignored thus far.
Looking at the framework source, creating a custom Email class and overriding the parseVariables() could possibly achieve it, but it seems like overkill?

After trying just now, the default email template can effectively be overriden with a custom one. I put mine under the "templates" folder of my theme (and not in any subfolder), ie
/themes/mytheme/templates/GenericEmail.ss
Then tested after a flush=1 (so that the new template is picked up)
Hope this helps

Related

Add custom flow on member registration form in Wordpress website

I have a Wordpress website and want to add custom flow of registration.
The current website has these pages but I am not sure if there is any plugin that has inbuilt such flow feature or how to add this feature.
Any help appreciated.
I had to do a similar modification.
Your case seems the same as mine, its a single form, split onto steps for helping users/validations.
I didn't found any plugin ready for all i needed (the steps thing), and mainly ... hooks to change registration form in wordpress just add extra fields to standard fields, i needed to completly remix the order, so I went the javascript way:
Added my custom css and JS to login/register pages with the action 'login_enqueue_scripts'
Added my custom fields to form using 'register_form' action
Added a class to login body with 'login_body_class' filter, to keep things hidden while JS magic happened;
I'm not sure what's your skill level in JS, but once you got those hooks ready you can make pretty much whatever you want with the register form.

nopCommerce - Dynamic theme activation for different pages - Not multi store

I was wondering how we can activate different themes on different pages dynamically.
For example few pages will have theme-1 and rest of the site will have theme-2. Users will not be selecting the themes. It will have to be set dynamically from the back end.
One way is to have separate master pages.
But is it possible that we have two nopCommerce themes and we activate any one dynamically on different pages of the same store? Not multi store.
It should be possible following these steps:
Create a new plugin.
Copy the current class ThemeContext, implementing IThemeContext to your plugin. Use a different name to avoid mistakes (see).
Register the new class with Autofac. Set a higher priority to ensure that the new class replaces the old ThemeContext. Enable the plugin and check it works by setting a breakpoint there.
Change the get part of the property WorkingThemeName in your new class and implement any business rules you need, returning the alternate theme name when appropriate. You may need to access the current RouteData to get the current route controller or parameters for each http request.
That's all. It is easier than it looks.

Html forms in wordpress theme

I have a form in tpl files and called the tpl in wordpress theme.so now the form is submitted to the theme file.
Can anyone tell me which way is the proper way for wordpress?
1.Getting the post values and pass the value to custom plugin function to process the db functionality.
2.Getting the post values and Process the db functionality in theme itself .
3.form action directly to the custom plugin function.
Thanks
Technically the best thing to do is to write a plugin that will also provide the template(you can of course allow the theme a way of overriding that - for instance by using locate_template( 'my-plugin-template.php' ) to check if the template exists in the current theme).
You should then process the form submission in your plugin - I would either check for the form values on the template_redirect action filter for instance(you can do it earlier as well - like on init for instance), or even right before loading the template if you don't need to do a redirect.
The idea behind using a plugin, vs putting all of the code in the theme is that if you decide to change your theme in the future, it would be more easy to keep the same functionality in the new theme as well.
I personally try to avoid calling plugin files directly(the third option you thought of) - not that it has any side-effects that I know of, but it's just my own preference.

Wordpress, alternative single post template

For a project of mine I need to define an alternative template for single posts.
To be more specific I need each post to be displayed as usual when the website is browsed but I need to create different single pages reachable from different URL to create a sort of a mini-website for each post.
(I'm actually using the WooCommerce plugin and what I need to do is to create a mini-website for each product. This needs to be something "outside" from the main website, with a complete different graphic template and is going to be reachable through a QR-code).
Hope it makes a bit of sense.
Thanks for your advices and/or suggestions.
Angelo
I think the easiest way to do that is by registering a custom post type for the special posts that get this special "single.php" template. Then, you can simply write a new single template titled post-[custom post_type].php. Any post you register of this type will use that template.
OR...
If you don't actually need them to be posts, it's even easier if you publish them as pages. By default, pages let you assign a specific page template in the edit screen. So you could make any number of custom templates. Just make sure you add the special header:
/* Template Name: Custom Page */
...so WP knows it's a page template.

theme specipic element in form api drupal6

how can i theme a specipc element that created by node form? i saw mytheme_checkbox etc but i want to do phoneselect_theme() { } and change there the value or whatever
You should be able to use the Theme Developer module to find which function or template file is outputting the part of the page you're interested in theming. Theme Developer will also tell you what "suggestions" you can use to override the output. Check out the Theme Developer screencast for an introduction on how to use the module.
Implement a form alter hook in your module, and then use the #theme attribute inside the alter hook to override the form element's theming.
You'll want to know the exact form ID of your form. This writeup by Lullabot will tell you how to find the form ID and it will give you an example of how to modify forms.
Don't forget to register your new theming function using the theme hook.

Resources