select Template module via GRAV Admin plugin - grav

Hi i created my first GRAV-Template with modular-pages.
Now i want to setup my Grav-Admin page fields to let the editor choose one of my module files themes/my-theme/modular/xyz-module.html.twig via a select-field.
In other words, i need a select-field like the Pages Field but within my template-modular-files.

In the GRAV documentation you will find following sentences:
Modular subpages are in folders with names that begin with an underscore (_).
To select a modular template, i do this steps:
Add Page (i.e. Sample)
Set the parent page to a modular page
Continue
Change the folder name to _sample
Save the page
Now you can choose your modular Page Template
Remember to add the new modular page to modular.md

Related

How to add custom master page options to the Kentico new website wizard

I'm in the process of building a new website and I am making use of the Kentico new website wizard.
On step 5, you get to select a master page. Currently I see 2 default options.
How am I able to add my own custom master page that I created and saved in the CMSTemplates folder?
Any help would be great.
Thanks
After you created the template in CMSTemplates - I assume it is ASPX template, have you registered it in Kentico as master page template? If not, please see the documentation on creating ASPX templates.
It really does not matter. You can go with default blank master page or any other option and later on you can change it. After creating a site you will end with one root element in the tree and the master template assigned to it (the one you chose in the wizard). Now you can change your master template: go to page templates and create a new one, then go back to the root page and go to root page properties/template and assign the one you created.
This root master template is not some "read only? frozen forever" thing. You can change it to different one at any point at time.
P.S. If you want your template appear in the site wizard - just create it in advance, mark it as master template and it will appear.
There are two things required to do.
Put the newly created template in the "Templates" folder then run an insert statement in SQL to "register" the template so that it will show up when in Kentico when you want to create a new site from the internal web templates.
This is how I did it.
In order for the user to click to add a new website so that our new custom website template is displayed in the list of websites,we need to add this information to the CMS_WebTemplate database table so that Kentico can map or “register” the physical path to the custom website template.
The script is as follows:
INSERT INTO CMS_WebTemplate
SELECT 'New Site For Testing',
'~\App_Data\Templates\BlankNewSite',
'{$webtemplate.blanksite.description$}',
NEWID(),
GETDATE(),
'BlankNewSite',
10,--order of the website template so you need to look for the last digit and increment by 1
'F;B;N;X;V',
'a928c1d2-1bcd-459c-abcb-9f5a08978017', --default web thumbnail id for the blank site
The Blank New Site for testing provides a template for creating new websites from scratch, based on the portal engine.'
Now, the user will be able to create a new website using the new template that was placed in the C:\inetpub\wwwroot\Kentico10\CMS\App_Data\Templates directory which lives inside of the Kentico CMS web application
Steps:
1. Clone and rename existing website templates from C:\inetpub\wwwroot\Kentico10\CMS\App_Data\Templates
2. Run script in the database to map the website template and it’s physical path
3. Run wizard to create new website

Custom view for displaying contents in folder

We are using Plone 4.1, and would like to have a custom view of the contents in a folder.
The "Select a content item to be used as a default view in this folder" display won't work for us because we have Private subfolders which should only be listed when the logged-in user has the right permissions.
For example, we have a main folder called "IT". Inside this "IT" folder, we have subfolders called "Admin", "Users", "FAQ", etc. The "Admin" folder is not published, i.e. is private, and it should listed in the Folder display view only if the logged-in user is part of the admin group. The "Users" and "FAQ" folders are published -- so no problem here.
If we use "Select a content item to be used as a default view in this folder", the content page does not have the intelligence to list the "Admin" subfolder only when the logged-in user is part of the admin group.
We do not want to use the default views, i.e., Summary View, Standard View, Tabular View, although these views are able to list the "Admin" subfolder only when the logged-in user is part of the admin group.
Is there a way to have our own custom view which will display "Admin" subfolder when the logged-use is part of the admin group?
Yes, you can do this a couple different ways. It is recommended to do this in a theme product (or other product with a skins folder), but I will also give you instructions for doing this in the ZMI.
(1) Customize the template for one of the default views. Find the original template in Products/CMFPlone/skins/plone_content (copy the original template into your product's skins/templates folder), or in the ZMI at portal_skins > plone_content (click the customize button). Then adjust the template to your liking.
~ or ~
(2) Create a new template that will also be available in the Display dropdown. I would start by using one of the default templates so you have a good place to start from. Put the template in your product's skins/templates folder, or ZMI > portal_skins > custom folder, but this time give it a custom name. Then in portal_types > Folder, add the template id (the name without .pt) to the list of 'Available view methods'. This information can be exported to a product from portal_setup > export tab, an export the Types Tool.
Here is a product I created to add a new view to folders and collections that displays event objects in a tabular layout (something different than the default Tabular View). It's a very minimal product and should get you started on creating your own custom template.
https://bitbucket.org/paulrentschler/tabulareventsview

Display a Drupal page without the page template

Hello I am trying to generate a Drupal node which would be similar to a feed page generated by views module. I need to generate an xml feed, so I would not want to show the regular drupal template that is showed up on every node. I am trying to understand how the views for feed works as I want to display my page in a similar fashion, without the drupal template. Any suggestions would be great.
In Drupal you can theme any individual page to be completely different than the default template. So, if you have a node, let's say the url is "node/14", you can create a new template file called "page-node-14.tpl.php" in your theme folder. In this template you can add any html/xml markup you need. Also, for that specific node you should also create a "node-14.tpl.php" to theme that node's content.
If you want to display more nodes on a page, something like "taxonomy/term/3" (here you can find all nodes tagged with the term with the ID 3), you have to create a "page-taxonomy-term-3.tpl.php" template in your theme folder. To theme every node from one particular content type, you should create a "node-news.tpl.php" (this is for news node types) in your theme folder.
Please keep in mind that these template suggestions are for Drupal 6. In Drupal 7, the template name changed from "node-news.tpl.php" to "node--news.tpl.php"

Drupal Views2 Exposed Form

A while back you commented on a poster's question for how to alter the Drupal Views2 Exposed Form. In the post you mentioned:
The proper way of changing the theme would be to override the views-exposed-form.tpl file in your theme's folder. Bear in mind that this will apply to all exposed filter forms, to theme a specific one, you will need to use a different name for that filename, like:
views-exposed-form--TITLE--DISPLAY.tpl.php views-exposed-form--TITLE.tpl.php
and some others, you can check the Theme: Information section of your views for template naming conventions.
Can you expand on what the 'TITLE' and 'DISPLAY' are exactly? Are both template files needed or just one of them?
Thanks.
I am not the author of the post you are referring to, but I can answer this question.
The way Views theming works is that there is a base template for a specific part of the output and this base template can be made more specific by adding additional qualifiers to it.
If you copied /sites/all/modules/views/theme/views-exposed-form.tpl.php to your theme folder (or from wherever you have Views installed), made changes to the copy, and then edited your view and chose Theme: Information and clicked Rescan Template Files, Views would now use this template in your theme folder for rendering the exposed filters form. This is the base template name and so it will be used for every view's exposed filters form.
If the change you're making should be applied to every exposed filters form then you're done. However you probably want to limit this overriden template file to specific views or even specific displays of specific views. If you want to apply the template only to a view named testview then you could rename your theme's views-exposed-form.tpl.php to views-exposed-form--testview.tpl.php. Don't forget to use the Rescan Template Files button after each rename or new file. Now that template only applies to the view testview and all of its displays.
A view can have multiple displays - maybe a block, a page, a page for admins, etc. These are listed vertically down the left side of the edit page for a view. You can get more specific and target a particular display of a particular view. To do this, you might name this template file views-exposed-form--testview--page-1.tpl.php which would cause it only to be used for the testview view and only for the first page display of that view. You can find the display name by hovering over the tab - it will appear at the end of the URL your browser shows in the status (default, page_1, etc). Just remember to turn underscores to hyphens in the template filenames: use page-1 not page_1.
You can also target all pages for example: views-exposed-form--testview--page.tpl.php.
These naming conventions as well as a list of templates which can be overriden are available here: http://views.doc.logrus.com/ (click Views Template Files).
So, if you have a specific display or view where you want to override the default template then you only need a single file targeted for that combination. If you need to target additional views or display combinations, you will have more files.
You can try Views exposed form layout module for views exposed form theming.

How do I display individual fields in a custom block?

A have a view created with Drupal's Views module, and have given it a Block display. It has the following fields:
first_name
last_name
professional_title
I understand that I can create a "[viewname]-block.tpl.php" file to provide a custom theme for this particular block, overriding the generic block.tpl.php template file. Within this [viewname]-block.tpl.php file, how can I pull out individual fields (eg, First name) so that I may theme them individually, giving them different classes? I've taken a look at $block, which yields $block-content, containing all fields, but this is as granular as I have managed to go so far.
Any help is appreciated.
Go into the Views UI and navigate to the block view you're trying to theme.
Under basic settings (at the bottom of it in fact) you'll see a Theme Information link. Click it.
I'm copying and pasting the official description of what that does:
"This section lists all possible templates for the display plugin and for the style plugins, ordered roughly from the least specific to the most specific. The active template for each plugin -- which is the most specific template found on the system -- is highlighted in bold."
So find the template for the field you want to theme and click the link for it - you'll get code to copy and paste. The code will be really generic, but there are notes in the generated tpl file about how to pull more specific object data.
Hope that helps

Resources