Silverstripe not using HomePage.ss as Chrome? - silverstripe

Hi I followed the Silverstripe lesson https://www.silverstripe.org/learn/lessons/v4/working-with-multiple-templates-1, and even tried to download the code from repository but when I tried to create templates/HomePage.ss as chrome Silverstripe still uses Page.ss. Clearly lesson says "It first looks in the main templates/ directory to find the chrome for this page. If it finds HomePage.ss in there, it will select that as your chrome." What is missing?

The issue here is that you are conflating the idea between a Page template, and a HomePage template.
The Page 'chrome' template (as the lesson calls it) resides in templates/ because Page class is not namespaced, or that is it resides in the root namespace.
The HomePage class on the other hand is namespaced, and this must be reflected in the path to the template.
A main template (the 'chrome'), the template should be in templates/SilverStripe/Lessons/
A Layout template should reside in the same base, but with a Layout folder; templates/SilverStripe/Lessons/Layout
This information is featured in the lesson.
I understand you are frustrated, but spreading fear uncertainty and doubt about bugs before finding the answer to your question is not a nice thing to do.

You need to create a few folders in the templates folder, as described in that lesson:
Make a directory called templates/SilverStripe/Lessons. In that directory, create another directory called Layout/. In that directory, create HomePage.ss. The full path should be templates/SilverStripe/Lessons/Layout/HomePage.ss.
So you basically need to move your file from templates/HomePage.ss to templates/SilverStripe/Lessons/Layout/HomePage.ss

Silverstripe is buggy, I got same issue. Just switch to Wordpress.

Related

Silverstripe 4 and namespacing - where do the templates go?

I am upgrading a 3.x site to 4.x. All seemingly going fine and this morning I could actually load my site after upgrading the core framework and other modules.
I have just been through the Upgrading process found here and completed the part where I namespace all custom files in /mysite. Which I have done, with the exception of Page.php and PageController.php.
The issue I am having is since doing this namespacing, no page can find any template in the system. All pages use /framework/templates/SilverStripe/Control/Controller.ss (confirmed by markup in the source).
There is some very brief discussion in the upgrade doc that goes into templates, but very little. And I've spent the day trying to find tutorials on what the docs might mean by the incomplete statement:
Core template locations have moved - if you’re including or overriding these (e.g. for FormField templates) please adjust to the new paths.
(It's incomplete because it doesn't go on to say what "new paths" actually are.)
If you have a file /mysite/code/Page.php (with no namespace), would you expect the template in /mysite/template/Page.ss to load? In my case, it doesn't. If you had another page called HomePage that extended Page.php, but had the namespace Vendor\MySection, where would you expect to find the template in the file system?
Edit: Example of what is not working:
Page.php - no namespace
HomePage.php - namespace Vendor\MyProject
I have tried the following structure in both my /themes/[themename]/templates directory and /mysite/templates directory:
Page.ss
Vendor
MyProject
Layouts
HomePage.ss
In either case, neither the Page.ss template, or the HomePage.ss template is picked up. The page is presented by Controller.ss.
The only way I have got this to work is by removing namespacing from ALL pages and following the structure normally found in SS3.
Edit 2: Just the contents of my config.yml
SilverStripe\View\SSViewer:
themes:
- 'mytheme'
- '$default'
The templates should also be "namespaced";
The template dir in my latest SS4 project looks like
templates
Page.ss: global site structure incl. head and body tags
Layout
Page.ss: $Layout of Page.php
Includes
Header.ss
...
Vendor: my project's name
Includes: stuff that gets included in other templates
PageGallery.ss: gets included via <% include Vendor/PageGallery %>
Pages: for Vendor\Pages Namespace
Layout
FooPage.ss: for Vendor\Pages\FooPage class which gets used for $Layout in the global template
TBH the first try was a lot of WTF and trial and error

How to get Plone's CSS Registry to load new CSS files

I'm trying to upgrade a Plone 3.3.5 server to 4.3.6. However, when I update the site, I find that the CSS for the site is not carried over. If I go to my CSS Registry, I find that almost all of my CSS is producing the (resource not found or not accessible) error.
My confusion seems to be in how Plone locates and links/imports stylesheets in general as Plone seems to be loading virtually none of my CSS and pretty much giving me raw HTML in the browser. I'm assuming the CSS registry is loading CSS from the buildout-cache. With this assumption, an example stylesheet that I'm targeting is located under:
Plone/buildout-cache/eggs/Products.NuPlone-1.0b3-py2.7.egg/Products/NuPlone/skins/nuplone_styles/base.css
When the CSS Registry failed to load this, I noticed that some CSS was being loaded in via handles like this:
++resource++tinymce.stylesheets/tinymce.css
But this format doesn't work with base.css and others.
So my question is, given I've got a new product installed with some CSS included in it, how do I get Plone to target said CSS?
For resources inside "skins" FS folders, the way to register on portal_css tool is to simply provide the filename, so simply put there base.css.
If this is not working probably the nuplone_styles skin folder is not registered properly in the portal_skins tool.
So go to ZMI --> portal_skins --> click on "Properties" and check the following:
what theme is used? You must probably switch back to NuPlone (but I'm not sure if it works on Plone 4)
is the nuplone_styles folder in the list of CMF layers of the used theme?
Please note also that adding the nuplone_styles layer to another theme is not a good idea. Please think about copying CSS you need in the custom directory.
This is not an answer, but some additional explanation, not fitting in a comment:
The "old" way to include style-sheets via skin-folders, requires to specify only the file-name, not a full path, and will be found by traversal, meaning the first found file with the according name, will be taken. In case of several files with the same name, the order of skins matters.
The other way is to register style-sheets via a browser-package, to have an unambiguous path to a certain file, they must start with +++resource++.

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.

Wordpress Child not overridding parent

I'm using the twentytwelve template.
1. Went to my file manager (wp-content > themes) and created a new folder called twentytwelve-child
2. created a new file called style.css (put in the header and import css)
#import url("../twentytwelve/style.css");
3. activated it - went to Themes, activated the child, gave it a name "test".
I made changes in the File Manager:
body{background-color:#FFCC00; font-size:100px;}
.site-title{font-size:300px;}
Nothing happened.
Went back to wp-admin section, opened up child theme test and made test changes. That worked!!! But the changes in the File Manager were not read. That was bothersome.
Now I need to change the header. I created a file header.php in the child directory but it's not read either. If I go to the parent and make a change ("hey folks") it works.
I've spent over an hour trying to find out what is missing.
TIA
So the answer is somewhat unclear.
I removed my child theme. Created a new one. That still didn't work.
Troubleshooting tips - don't forget the obvious -- go to view source on your wordpress site and see if wordpress is calling your template. In my case it wasn't it was stuck on one my test themes. I deleted all my tests themes and did it again.
Now it works. What went wrong? Don't know? But now it does.
In your child theme the #import url was wrong or the theme parent name wasn't the exact same... its case sensitive. It can be tricky to get it just. Also the child theme may not be in the file structure that you assumed it was in.

How can I change the way my Drupal theme displays the front page

I am trying to build an website for my college's magazine. I used the "views" module to show a block of static content I created on the front page.
My question is: how can I edit the theme's css so it changes the way that block of static content is displayed?
For reference, here's the link to the site (in portuguese, and with almost zero content for now).
I can't access your site at the moment, so I'm basing this on fairly limited information. But if the home page is static content, the views module might not be appropriate. It might be better to create a page (In the menu, go to: Create content > page), make a note of the page's url, and then change the default home page to that url (Administer > Site Configuration > Site information, 'Default front page' is at the bottom). Although I might be misunderstanding what you mean by 'static content'.
But however you're creating the front page, don't edit the css in the theme - it'll get overwritten next time you upgrade. Instead you need to create a sub-theme.
As an example, if you want to subtheme Garland, in drupal 6. You first need to setup a directory for your themes. Go to sites/all/ in your drupal installation, and create a subdirectory called themes if it doesn't already exist. Go into that directory, and create a directory for your subtheme, say mytheme (i.e. sites/all/themes/mytheme/). Then use your text editor to create a file called mytheme.info in that directory, with the contents:
name = My Theme
version = 0.1
core = 6.x
base theme = garland
stylesheets[all][] = mytheme.css
And then use your text editor to create a file called mytheme.css in that directory, and put the extra CSS in there.
For more information, there's the druapl documentation on .info files and style sheets. Although, you might want to buy a book, as the online documentation isn't great.
The main css file that drives your content is the styles.css file located in your currently selected theme. In your case that means that most of your site styling is driven by this file: /aroda/roda/themes/garland/style.css with basic coloring effects handled by this file:
/aroda/roda/files/color/garland-d3985506/style.css
You're currently using Garland, the default Drupal theme included with the core download, so for best practices you shouldn't edit the included style.css file directly. Instead, you should, as Daniel James said, create a subdirectory in /sites/all called "themes".
If you're using Drupal 6, I'd follow Daniel James directions from there. If you're using Drupal 5, I'd go ahead and copy the garland directory into the themes directory and rename it for something specific to your site (aroda_v1) so you would have something like /sites/all/themes/aroda_v1 which would contain styles.css. At that point, you can edit the styles.css file directly to make any changes you see fit. Hope that helps!
It looks like most of your CSS info is in some *.css files. There is also some inline Style info on the page. Your style for the static info comes from the in-line stuff. I am not sure how Drupal generates the page but the place to start looking is for any properties for "ultima-edicao". That is what the surrounding DIV is called.

Resources