Drupal theme files outside of theme folder - drupal

Is there a place where I can place override theme files other than a theme's folder? For example, if I wanted to override the appearance of a view's row in the same style for more than one theme without having to use more than one file.
If there isn't a generic way to do this (for any theme file), is there a way to do it for a view's theme files?

In your module, you can use hook_theme to declare a theme function or template for your view's row. This way, your single template will be used by all your themes without any special code in them. See the Theming your views in your module section in the Views's API Advanced Help page.

You could include an include_once type statement in your tpl.php file and just import the code from where ever. This way you have any number of files that refer to one.
It is not recommended though since if you move your theme folder or rename anything this can be harder. Also if you put your theme in another site you need to keep track of all of these off-theme hacks.

I think views seeks tpls inside of the theme folder. It's be nice to have something like that though.

Related

How to change the woocommerce email template width?

I am trying to increase the email template width. And I am trying to modify the email-style.php, but it seems no way to change. How can I change it?
Thanks a lot.
The most useful one to copy is emails/email-styles.php and there you'll find the width is defined in two places at 600px; #template-container and #template-body but there's also all the other styles. Anything that is not defined but exists in the email can be added to this file.
I use an email preview plugin so I can see the effect in a web inspector.
if you wanted to be really clever you could include an external css file and then use scss to integrate with the rest of your site styles - eg colours.
The easiest and most common approach to do is to create a folder in your theme called woocommerce/ and then copy the entire templates/ directory from your woocommerce plugin or github into that. This will override the functionality from the plugin.
Here you can find the hardcoded table width.

What is the best way to implement a theme / template in meteor or angular-meteor

I've been having trouble implementing templates bought in themeforest in a meteor app.
I'm wondering, what would the best way to implement a template into a meteor app.
Two ways that I think of right now are:
(Tedious way)
Place javascript in Compatibility folder and try to name them in specific alphabetic order in order to get them to work properly.
Place css in client/lib folder and try to name them in specific alphabetic order in order to get them to work properly.
Place fonts and images in the public folder.
The second way (I haven't tested it yet) is to place the template files in the public folder and just link them manually (the old/non-meteor way) in the index.html file.
Now I'm not sure if these are the correct ways to do this and I would like some information regarding this issue.
Thanks!
I've done this myself with a themeforest theme.
Put the theme's css file under /client - it doesn't need to be in /public
Use the class names your theme uses in your templates. Typically a theme will have 3x what you really need so this ends up being much less work than it might seem. If your theme is built on bootstrap then it's even easier.
My theme used fontello a lot for icons, I had to recreate the folder hierarchy under client/fonts and then make sure the cross-references were correct.
Typically themeforest themes don't use js that much, I completely ignored all the js that came with my theme and created what I really needed in Meteor.

Prestashop changes to theme

I have been tasked with making a small design change (CSS) to a Prestashop site that used an off the shelf theme.
I know that in WordPress you can make a child theme to put your design changes in which is best practice.
Is there a similar method I should be using in Prestashop? Or alternatively is there anywhere in the dashboard I can put these changes?
If you're building from a default theme, then the correct way would be to go to Themes > Add New Theme > Create New Theme > Copy default-bootstrap and create a new theme.
There are no child themes in PrestaShop (any kind of inheritance system for themes would majorly complicate an already complex system). What you have is what you work with. If you bought a third party theme, then go modify it directly (modify .tpl files, modify global.css, etc.). IF you copied default theme, then work with your copy (just don't work with default theme, it may get updated).
An event better way would be to install compass and modify .sass files (that is the most correctest :D way).

Drupal Style Configuration

I searched a lot on the internet to see a general answer about customizing the view of Drupal main components(if I can call them components) like Fields, Blocks, Views...
I know CSS can work and ... but I need to know if I find the html elements in which CSS files I should put the configurations.
I know it depends on theme css files. But which ones should be used for each of those components?
Thanks
Generally, the html files are in the theme folder.
If you are using Omega (for example), in the sites/all/themes/omega, you have the .tpl files, that Drupal uses to render the content.
For example, the file block.tpl.php is the file that contains the skeleton of any block in your site. Of course the content of the blocks is in the block page (not in the tpl).
The node content is in the node.tpl.php file, you may override the skeleton of any content type if you create other tpl file, for example node--article.tpl.php (for article content type).
You have html.tpl.php and page.tpl.php to customize the skeleton of your page. If you add some html in this files, this content appears in all pages.
Maybe this article helps you: https://www.drupal.org/node/171194
Regards.

ASP.NET Theme'ing along with customer specific images and css

We have a ASP.NET solution using images, css and .skin files with in the App_Theme/{selected theme}. The themes today contains many, many files and images and for a customer theme we add a new folder to the App_Themes and copy all files to the new folder and make the 10-200 changes on images, skin and css's.
The issue here is that the default theme, the one we normally have when we develop, evolve's and grows making theme customer theme out of date. So when an upgrade comes we have to go through all files looking for changes and hopefully finding them all. Sometimes we miss things that are really important.
The perfect solution would be to have a base theme that contains the base css, skin and images. And when we add a new customer theme we only tell the system what has been changed, what css-selectors to override and what images to use instead of the images from the base theme. In my understanding, if using the normal ASP.NET theme functionality in App_Themes folder, you can only have ONE theme and not a BASE theme and then say a DeliveryCustomer-theme that has a different background and some other images that the solution shall use instead of the ones in the BASE-theme.
Does anyone have some guidelines to solve this in a maintainable way for the future. I seen that people override the App_Theme path to make it work with custom skins.
thanks!
Use the concept of a base theme like you described. Pull out all common CSS rules into another file, let's call it base.css.
Take base.css and all the images that are common, and put them in a folder outside of App_Themes, and just include the CSS file like you normally would any other on your master page.
<link rel="stylesheet" type="text/css" href="/styles/base.css" /> <!-- Note this isn't in app_themes -->
Then, make sure your CSS files in various themes only specify the delta for your styles.
Ok, so here is how I'v done it know.
I have created a Default theme that is the original theme with all the css-files, skin-files and images that is needed, and that is alot. This theme is in the App_Themes folder. Them I'v created a new folder called ThemeSkins next to the App_Themes folder. In this folder I have all the new skins in different folders. The folders name is the name of the new theme that one want's to have. In each of the skin folders there are css-files that contains only the selectors that I want to overload. There is also images that I want to replace.
I have created a ThemeCreator tool that does three things:
Remove all themes except the Default theme in the App_Themes folder. This is to only have one main theme to work on for the developers. There will still be work that needs to be done in the ThemeSkins, but the overall work load will be minimal.
Next the tool looks at the folders that is in ThemeSkins and creates a folder under App_Themes for each skin with its name. Then it copies the Default theme into all the new skin folders that it just created.
The last thing is that it will merge the skin specific files into the newly created skin under App_Themes and let the user know what files were added just for information. The tool adds a prefix, "z_", on all css-files so that these are loaded last of all css-files and there for will overload the default selectors.
The thing that remains is to update the skin-files, so far, no customer has needed changes in these files. But when they do, I guess I just add a skin files and have to update the default in a automatic way since the skin-markers can't be overloaded as css-selectors can.
This works really smooth and gives us a nice and lean way to work with skins on our themes.
Any one got a better idea how to get the same result? the major issue using ASP.NET themes are that you can't use a default theme and then just apply skins to it without using the shape and color attribute in the skin-files. This is not recommended as the skin files will copy out all attribute to all the places that they are needed in the markup and not just reference them as css-classes do.

Resources