I have one MainTemplate shared with pages like : home,about-us,contact-us
I also have template variable to control all pages' : meta description, og title, og image, og desc
I created a Template Variable Home Page Banner link to my MainTemplate to upload images just for Home Page, but when i click other resources, this Home Page Banner Template Variable will show up also.
Any method that makes Home Page Banner TV shows up on home resources only?
Is it duplicate another template from MainTemplate named as HomeTemplate for Home Page Banner TV only?
Personally I felt this way is abit dangerous for future maintanance.
May I know any more method to achieve this?
Tq.
For "Home Page Banner" it is better to use http://modx.com/extras/package/bannery (docs - https://rtfm.modx.com/extras/revo/bannery)
I think it will be more complicated than a home-page-banner in main-template, but... If you really want to have the same html on multiple templates, simply create common chunk with your html, e.g.:
<html>
<head>
<title>[[++site_name]] - [[*pagetitle]]</title>
<base href="[[++site_url]]" />
</head>
<body>
[[*content]]
</body>
</html>
and in your templates (home-template and main-template) instead of html use only this:
[[$your-chunk-name]]
Then you can add a home-page-banner only to the home-template.
Sounds like you have the Template Variable set to show up in both your Main Template and your Home Template. Your TV should just be set to show up on the Homepage Template which you set under Your TV > Template Access and then untick the Main Template checkbox.
As mwl says - is long as you keep your templates simple (i.e. you use Chunks and Snippets wisely) having lots of templates isn't a bad thing on a MODX site.
Related
I'm trying to work out a way I can add my H1 and byline markup to my Root master page and then have all the pages underneath fill these fields in. I'm using the Portal Engine development mode.
The H1 and byline are in a different web part zone to the page placeholder. They are showing on all the pages under my root node but I can't find a way to make populate the title or byline on those pages.
I've tried a few things:
- editable text web part - but this is only editable on the Root node and not the pages underneath
- I thought maybe I could use <%# Eval("Byline" %> and add this as a field to the Page type but that doesn't show through either.
Is there any way to include something in the master page that is dynamically filled in (or editable in the designer) on all pages under the root node? Or do I need to move myH1 and byline out of the master page and include in every template that my pages use?
You can add additional field to your page type named 'Byline'. This field will be editable on Form tab of each page. Then you can include some viewer web part like Document Viewer or repeater. Then configure Path like './' (it means to display information for current page). And add transformation where you cat do something like <%# Eval("Byline") %>.
Or alternative way is to use static html web part and add macro there {%CurrentDocument.Byline%}.
You can do it using macros: add a static text web part on your master and set text property to :
<h1>{%CurrentDocument.DocumentPageTitle#%}</h1>
or
<h1>{%CurrentDocument.DocumentName#%}</h1>
depending on where you keep your page title.
I am using one page template which contains master page layout also. Now when i access the page having layout which is displaying in browser. Now i wanted here if i use querystring like below:
http://localhost/Mywebsite/page?AppMode=true
then i wanted here to show only content of the page master layout should not be displayed with page content.
Currently i am using Kentico9.
A page's template is not something you can do with a macro, however you can control a Page Placeholder webpart with a macro/querystring.
So in order to do what you want, this is what you'll need to do.
For the page's actual template, it will pretty much just be a 'blank' page template, with a Page Placeholder webpart in it.
For the page placeholder webpart, set the path to "." (so it shows this page), and the Page Template you can then set with a macro: {% (Convert.ToBool(QueryString.AppMode, false) ? "NotAppModeTemplate" : "AppModeTemplate") %}
Tell me if that does the trick for ya! The only caviote is the only 'control' of the master template used is in the template settings, which can inherit the root or the nearest master template, so if you want one template to use 1 master page, and the other to use a different, you'll have to set the masterpages somewhere in their ancestry and then use the "Inherit from Level 0,1,2..." setting in the Page Template.
Assuming you're doing this using Kentico's ASPX mode of development. Do a simple check for the querystring and set the visibility of the placeholder in code behind. If I were doing this in Portal mode, I'd do that with a macro on a webpart.
I used in master page template conditional layout and that layout i used visible property with macro querystring with my condition except for my content place holder and it is working fine as i wanted.
I need to make a footer in Liferay and use theme for it. What's the simpliest way to do it?
I have created new theme, filled _diffs folder with other folders, but it's empty and I couldn't find relevant docs about this. Should I copy all basic files there? What should I change to create footer?
In Liferay, theme's portal_normal.vm serves as the template to
construct HTML structure of the page. There you define your header,
body and footer includes.
When you will look at the portal_normal.vm of classic theme, you will observe following HTML snippet:
<footer id="footer" role="contentinfo">
<p class="powered-by">
#language ("powered-by")
Liferay
</p>
</footer>
This is the footer of the page. This is what you need to implement. However, it's not necessary to use footer tag at all, as you can simply use div or table based structure with bootstrap or customized CSS classes for your footer, it's upto your requirement.
Remember! Classic theme is just like a sample provided by Liferay, so, it's not good idea to directly customize it.
Everybody needs a whole customized view of the site, and for this the best idea is to create a custom theme (that's what you are doing!), that will give you full control over your look-n-feel.
To kick-start, you can initially copy required folders from classic theme to your customized theme's (_diffs folder) and start changing bit by bit.
I'm using the Grav CMS and would like to have a block of global content present on each page. In other words, every page on the site will have this same block of content (near the footer). I'd like the content of this block to be editable similar to other pages, through a .md file. Instead of hardcoding the content of this block into the base.html.twig (or another) template the content should be editable through a .md file similar to other pages.
One option, use find() to pull the content of the page I want into each page. The downside to this is that I don't want this page to appear in the navigation. If there is a way to hide a page from the navigation this might work however.
What is the recommended way to accomplish this?
I solved this by creating a variable containing the page object from the page I wanted. Within the base.html.twig template I did the following:
{% set secondpage = page.find('/_page_url') %}
{{secondpage.content}
The _page_url is hidden due to the _, but still editable as a normal page.
i have to make some updates to a web site built using expression engine. There is no staging area available so i'd like to create a test area of the web site accessible only to site owners allowing them to preview the changes.
Ordinarily, i'd just create a "test" folder and direct the users to this URL. I'm new to Expression Engine and not sure how to achieve this. Any help would be much appreciated.
You can just create a new template group and templates (e.g., "section_test"), direct them there to preview, and then change the template/group names to the proper names once you're ready to launch.
As an additional layer of security, you can add HTTP authentication to this test template.
For previewing CSS changes, I added this to the of my templates:
{if group_title=="Super Admins"}
<link rel="stylesheet" type="text/css" media="all" href="/design/style-dev.css" />
{if:else}
<link rel="stylesheet" type="text/css" media="all" href="/design/style.css" />
{/if}
If the test section is a particular channel, in the control panel you can set the permissions on the channel so that only a particular group can view it.
If you regularly need to preview pages before they go live, consider creating a new status, like "preview". By default, EE only shows items where the status is open. You can specify which statuses are shown like this:
{exp:channel:entries weblog="myPages" status="open|preview"}
{if status == "preview"}
{if group_title == "Super Admins"}
<p>the title is {title}</p>
{/if}
{/if}
<p>the title is {title}</p>
{/exp:channel:entries}
This example uses nested conditionals instead of a conditional with an AND in it, because conditionals with ANDs are considered complex and are parsed differently. (Look up complex conditionals to learn more.)
You have to repeat all the display code within the entries tag pair, so consider using an embed or a snippet for the repeated code.