How to make multiple editable parts on homepage/other pages in Silverstripe CMS? - silverstripe

I am new to Silverstripe so am still learning the best way to achieve certain results.
I have the following website: http://i.imgur.com/HHHIlwA.jpg - that I have converted into a silverstripe theme etc. I have setup the front page as a HomePage.ss.
Now I want to be able to edit most parts of the page from the CMS. I have followed this tutorial on this website: http://www.silverstripe.org/learn/lessons/working-with-data-relationships-has-many - and have created a region under the "Articles" heading in the pic which comes up as a tab on the CMS in the admin panel. http://i.imgur.com/Gi7kZmq.png
My question is, is the best way to make parts editable to make them regions like what the video has shown etc? E.g if I wanted to edit the section in the pic that has the picture of the big ring and the text next to it, am I best to make this another region? What about for things like headings etc?
Thanks in advance :)

There are several possibilities to solve this problem:
either use several $has_many for each group if you have a fixed structure
if you need flexibile structure you can use one of the several 'block' modules like https://github.com/bummzack/page-blocks or https://github.com/NobrainerWeb/Silverstripe-Content-Blocks.
There are some more modules like this around, each have pros and cons, depending if you need reusable blocks, translatable blocks, want to save the relations with Versioned etc... #lerni made an overview about those modules.

Related

What is the best way to create a modular Wordpress theme?

I'm going to create a theme and I would like to create a functionality that I have seen in other themes that I have used: for example every page can be created with different modules in different order (videos, images, texts, etc...) so its up to the person creating the page to decide which elements are going to be used.
What is the best way to achieve this? I have created custom templates but I have never tried to separate the content with modules, my first guess is that it can be done using WPBakery or a similar plugin because that is what I have seen in the themes I have bought but I'm wondering if that's the best option. Do you have any recommendations or maybe a tutorial where I can see how I can accomplish this?
Thank you.
Use Advanced Custom Fields plugin and create a field with multiple possible elements. So you decide how elements will look like and the client can build his own site with that modules. The chance the client will break the layout because of superfancy layout builder is nearly zero.

Example on how to reuses areas in magnolia?

I am a little bit confused. How do we reuse areas from another page? Lets say I created an article in an articles area on my index page. How do I display that same content in another page?
Ive read the following https://documentation.magnolia-cms.com/display/DOCS53/Reusing+area+content
Seems kind of complex. I dont understand the pom file.
Cant we acccomplish this purely in light modules? If not, could someone show me an example of a simple content reuse scenario?
Yes you can do it purely w/ light modules. Look at this article. Example there is custom "quotation" app and the quotes you create you can render and reuse in as many different pages/page-types you want.
However it is slightly different than what you ask. In your question you want to reuse content from the page, which is also possible (you just need to address that content and feed it to appropriate cms tag in your page template (you can forget all about maven and so on, just focus on your templates). In the example I point you to, you create custom app for stories, articles or any kind of content and then just refer it from all pages where you want to render it. This allows you not only to share the content, but also separate it's editing from the page structure which makes life of editors easier in long run.

Drupal - Show content on specific page

Am I able to add the following field to a content type, so that each piece of content I create can be conditioned to a page?
Or is there a module to extend Publishing Options, where by it adds all the pages I have created (just like 'Promote to Front Page')?
If not, why is no one doing this? As a new user to Drupal this seems like it would be a handy operation. (I have already tried this module but it doesn't achieve the results I'm after).
If none of these solutions are available, what would be the best alternative way of doing this?
I've posted this question on Stack Exchange for Drupal but I need a quick answer and there seems to be a bigger community here :D
You should use Context. With Context, you'll be able to manage contextual conditions and reactions for your drupal like Regions.
Have you used Views? it is one of the most common used drupal modules. It doesn't extend publishing options directly but it does replace it in a way. You can say by example put a list of al content-types: your_own_Content_type that have the publishing options of promoted to front-page. then sort them by title, date, what ever you like.
you could also create only one view and create multiple blocks out of it. you have to understand the logic of drupal: if you want different blocks on different pages, you have to create the different pages AND different blocks
create the view for one type of content-type and make one block out of it. put this block on the desired page. All your other blocks are made with the same view, just adjust a condition in your view and create a new block out of it. You should also put all your blocks in the same region, and set the to the right pages
here you can find a lot of documentation if you run into any problems... drupal.org/project/views
Views is the best at creating a slideshow of images or any type of data on your site.
Used in combination with nodequeue it might offer near or the full functionality you are trying to achieve (check this out ... and this too) - but I don't understand your question entirely.
By my opinion Views is too complicated task for much simple request.
There is a few ideas for solution:
Easy way - You can create a specific template file or add some if statments to the node.tpl.php(specific tpl better)
For minor changes - Create a new context with "path" filter and "theme html" reaction, than hide the field by the css
Best but complicated(large usages) - create a new "view mode" and implement the display by new "hook_menu".
~ Almog

How to have a three column home page in Drupal

The home page of this site will have basically a 3 column layout.
I can create these as either content or blocks. I like using content because its easy for the user to understand, they login to the site, they browse to the page they want to edit, they click edit, but with blocks they have to go into Administer > Blocks etc
Any suggestions on this?
I would be managing the actual content as nodes(content) and then looking at blocks(or something like it) to arrange them how you like in your template regions.
If you are looking at creating custom home and/or landing pages, you might also want to look at http://drupal.org/project/panels - it can be a little heavy, but quite powerful for arranging content into columns and whatnot.
Not really sure what you're asking...
Administer > Blocks is for moving the blocks around into regions / disabling them, not really for creating content.
You can use the Node as Block module to easily turn your nodes into blocks, and they would still edit it from the content administration section.
Or, you could create a blank block, and in its associated template file (block-whatever.tpl.php) embed the node (node_embed, pretty much what the Node as Block module does) or query for it with a view and embed that (views_embed_view)
Or, if you're using views, you could create a view that queries for the node(s) you want and create a block display for that.
When you're actually building the Drupal site, you should consider what paradigm you're most comfortable with since there are so many ways to get your content together.
i would say boxes will help you. http://drupal.org/project/boxes
Many themes have block edit links/images as a part of them. Fusion is one such example.
I would suggest looking into Panels for layout and block editing, and also to download a version of open atrium. The layout management is uses is much easier than the administer blocks pattern.

How to theme a view in drupal

Can any one help me out on how to theme a view.
For each view created i want to have different templates.
Theming views can be somewhat tricky, depending on the kind of views you have created and the changes you need to make. Check out this introduction for Views 2, and make sure to install the Advanced Help module to get at the views2 documentation from the views module itself (there will be a link to the documentation on your views overview and edit pages, once you activated the Advanced Help module).
You can also find some questions/answers here on SO (e.g. Drupal 6: How to quickly theme a view?), if you search a bit.
I actually did this the other day. Ill give you a brief overview and expand a little later.
Set up your view; by going to Views -> Add View
Once, your view is completely set up, at the bottom of the view (left column in D6, right-most "Advanced" column in D7), you will see a link called "Theme: Information", click on it.
What you will be presented with is a list of templates (.tpl.php) files that the views uses to theme your data. Basically the file names that are bolded are the files views is using to theme the data.
To Customize Your Views
Select the page you need to theme. For Example, if you created a "Block" view, and I wanted to customize the basic html layout, I would pick a name (other than the one that is currently bolded) that is being displayed to me and create the file in my themes directory (sites/all/zen/custom-file-view-fields-views.tpl.php) - this is if views told me that I could use the filename custom-file-view-fields-views.tpl.php
The next step is knowing what code you need to put in there. The quickest way, is to go back to the theming information in views, click on the link of the file your replacing and grab the code that is presented to you. Paste that code in the file you created.
From here on out, you can now successfully customize that view.
Keep in mind that the theming information presented to you is presented from basic to complex (up to down). So choose which file you need to edit carefully. Ill put up some images in this answer a little later.
Hope this helps! Cheers!
Is there something specific you're trying to accomplish? There's a lot of ways to "theme" a view, unless you mean "theme" in the strict Drupal sense.
Personally I just give the fields classes and use those, rewriting the output to include variables as classes if need be. This tends to be easier and more manageable than modifying TPL files directly.

Resources