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.
Related
My end goal is to have a page that displays a Heading then links.
The Heading text would come from child folder, and the links would be pages within that folder.
I'm not concerned about the actual HTML at this point, but say an h2 for the header, an LI for each link.
I had thought i could create a repeater with a transformation to grab the folder name, and then all the sub nodes, but i'm struggling here since I've never tackled something like this in Kentico before, and have never attempted to build a navigation system using hierarchical transformations.
Here's my current content tree
Missed Payments
Group
Arrears Overview
Arrears Deductions
Flex
When rendered, Missed Payments should have the following code. When i add mew pages to Group and Flex, page links are shown
<h2>Group</h2>
<ul>
<li><a href='link to overview'></a>Page Name</li>
<li><a href='link to deductions'></a>Page Name</li>
</ul>
<h2>Flex First</h2>
I have a Header, Item and Footer transformation types, with Header, Link and Footer transformation. The HTML is simple, but i'm missing the piece to bring it all together.
Have you looked at the Creating a Mega Menu using Hierarchical transformations how to on Kentico?
For your level 0 header have <ul><li>
Level 1 header have
<ul>
<li><h2>{% Documents[NodeAliasPath].Parent.DocumentName #%}</h2></li>
<li>
All levels item: <a href="{% Transformation.GetDocumentUrl() #%}" >{%DocumentName%}</a>
All level separator: </li><li>
Footer: </li><li>
Make sure transformation type is Text/XML
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.
Google Image Search can also filter for re-use licences of the images. I'm wondering how they know which licence an image is published under. How can I declare that licence on my website? Is it possible to declare a licence for each image on the page, or only for the entire page including all referenced images (possibly including pre-fetched content)? And what are the licences that Google understands and can classify to their filter?
I've searched around for a while and have finally found a solution, thanks to Creative Commons. In short, for Google (and other search engines) to know what license the content on a specific page is under, you have to tell it.
This is done the same way as you give Google other data like page relationships - using the HTML structure of the page. In this case, you use the rel attribute of a tags. To declare a single-page license:
License
Of course you can change the link text to whatever, but the important bit is the rel attribute. The href should point to the license itself.
I don't know how Google knows what license it is, but that's how you declare it, and Google's robots will do the magic for you. In terms of bulk licensing, I dare say you could preprocess pages with PHP (possibly in conjunction with an SQL database) to insert this license tag.
Sources:
Creative Commons Licence Chooser;
MicroFormats' RelLicense
You can also have a look at Sitepoint's definition of the rel attribute and its uses.
Hope this helps.
In this answer, I am assuming that:
You have a collection of images licensed under, say, a Creative Commons license.
You want image search engines to return your images when the user is filtering for Creative Commons-like images.
Creating metadata HTML pages
I think the best way to attach licensing information to an image is to create a canonical HTML page corresponding to each image--much like how Wikipedia or Flickr does it.
Let's say that we want to license a gallery of images under CC BY-SA 3.0 where every image has a URL of the format https://example.com/img1.jpg.
In that case, we embed the licensing information in HTML pages with URLs that look like https://example.com/img1.jpg.html.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Viewing img1.jpg</title>
<meta property="og:image" content="https://example.com/img1.jpg" />
<link rel="license" href="https://creativecommons.org/licenses/by-sa/3.0/"/>
<link rel="canonical" href="https://example.com/img1.jpg.html"/>
</head>
<body>
<div>
<img src="https://example.com/img1.jpg" />
<small>
This image is licensed under a
<a rel="license" href="https://creativecommons.org/licenses/by-sa/3.0/">Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)</a> license
</small>
</div>
</body>
</html>
Using schema.org metadata
We can also schema.org ImageObject metadata to our metadata pages--encoding our metadata as microdata, RDFa, or JSON-LD. The schema.org markup makes it possible to add additional annotations that describe the copyright holder and how to obtain a license to use the image.
Here is an example of a JSON-LD document that you can put inside the <head> tags.
<script type="application/ld+json">
{
"#context": "https://schema.org",
"#type": "ImageObject",
"author": "Bob Smith",
"copyrightHolder": "Bob Smith's employer",
"copyrightYear": 2021,
"contentUrl": "https://example.com/img1.jpg",
"license": "https://creativecommons.org/licenses/by-sa/3.0/",
"acquireLicensePage": "https://example.com/img1.jpg.html"
}
</script>
Exposing your metadata HTML pages to search engines
Finally, you should make it easy for crawlers to find these HTML pages. You can organically pepper in links to these HTML pages whenever you embed one of your images. Alternatively, you could just list all of your HTML pages with the Sitemap Protocol.
I'm using modx revolution. I'd like to create a chunk called layout that calls other chucks example
Head
header
nav
body
footer
then in my template do something like //open layout tag[[$layout]] [[$layout]]//close layout tag. then inside of the the open close tags append my [[*content]]. this would allow me to reuse my layout template over and over again without having to replicate it in the templates. First question, is it possible, second what kind of syntax would be needed to achieve this goal? I'm rather new to modx and know it's possible with other frameworks, so any help would be appreciated. Thanks.
Sample concept done in Apache Tapestry framework, obviously different syntax, but should give you the general idea of what I'm looking for.
components/Chunks used.
Layout
Header
Nav
Footer
Inside of layout
<html>
<t:Header/>
<t:Nav/>
<t:Body/>
<t:Footer/>
</html>
Inside of Index/Template
<t:Layout>
template body content goes here ex. [[*content]]
</t:Layout>
Hope this helps to clarify.
Your post is not very clear and I think you haven't really taken much time to read up on how MODx works before looking for help.
That aside, I think what you want to do is create different templates, structured more or less like this:
[[$header]]
[[$nav]]
<div id="content">
<h1>[[*pagetitle]]</h1>
[[*content]]
</div>
[[$footer]]
That might do for your home page, then for internal pages where the layout is a bit different you can create one or more new templates for each layout:
[[$header]]
[[$nav]]
<div id="content">
<h1>[[*pagetitle]]</h1>
[[*content]]
</div>
[[$sidebar-chunk]]
[[$footer]]
You can even show different layouts using a single template something like this:
[[$header]]
[[$nav]]
<div id="content">
<h1>[[*pagetitle]]</h1>
[[*content]]
</div>
[[*parent:is=`6`:then=`
[[$recent-articles]]
`:else=`
[[$sidebar-chunk]]
`]]
[[$footer]]
That should get you started, but you'll soon realise there are multiple ways to do everything in MODx.
You can put your [[*content]] where-ever you want, even inside another chunk, if that's what you mean.
So your [[$layout]] chunk could just be this:
[[$header]]
[[$menu]]
<div id="content">
<h1>[[*pagetitle]]</h1>
[[*content]]
</div>
If you want to make some minor changes in a chunk on a template-basis you could also do something like this in the template:
[[$layout? &customContentBits=`
<h1>[[*pagetitle]]</h1>
[[*content]]
`]]
and your layout chunk could then be something like this:
[[$header]]
[[$menu]]
<div id="content">
[[+customContentBits]]
</div>
That's a placeholder ([[+customContentBits]]) which is set by adding the &customContentBits in the chunk call.
Explained that a tad more with a different use case on my blog some time ago too: http://www.markhamstra.com/modx-blog/2010/10/introducing-element-properties-and-output-modifier/
What you are asking can absolutely be done. In fact, on my website, I even have the same template/chunk combo providing multiple layouts by passing a template variable as a chunk modifier. But anyhow, let's keep things simple.
A quick note on your question., ModX doesn't use start tags and end tags, natively. It's best to stop thinking that way. Instead just place things where you want to place them. Resource variables can go in any chunk, as each resource is unique.
Create your Chunks:
First, start with the simple ones. Create your Header, Footer, and Navigation. Next, create your Body. Inside the Body, make sure to include your [[*content]] (no... it doesn't have to go into the Template. Finally, create your Layout with the following code:
[[$header]]
[[$navigation]]
[[$body]]
[[$footer]]
Create your Template:
Your template can now be as simple as [[$layout]]. You're done.
Note
While you can do this with ModX, understand that the power of ModX is that you can have multiple templates and chunks depending on the type of content you have. Singularizing everything like this really takes away a major advantage of using the platform.
Mark Hamstra more or less gave you the answer, but just to clarify: Any snippet, chunk or output of some sort in Modx can take parameters. Chunks and snippets especially can make use of these params easily. From what i understand you want to have all your templates call [[$layout]] and nothing else.
The layout chunk in turn looks like
[[$header]]
[[$navigation]]
[[$body]]
[[$footer]]
On this you simply build and add your params, nesting them down from the top like
[[$layout? &useNavigation=`1`]]
(And continue passing the param in your layout chunk)
[[$header]]
[[+useNavigation:is=`1`:then=`[[$navigation]]`]]
[[$body]]
[[$footer]]
Another way of accomplishing the same behaviour would be to use a single template to which you have connected a series of template variables that decide how the template looks like. You might have template variable called useNavigation of checkbox type. If you check this through the resource editor it will be passed to your $layout chunk directly without having to add params into the $layout chunk call.
[[$layout]]
(Just call layout normally and add the TV checks to the layout chunk directly.
Note the difference between calling a TV and a placeholder, + vs *)
[[$header]]
[[*useNavigation:is=`1`:then=`[[$navigation]]`]]
[[$body]]
[[$footer]]
I've been searching high and low for a satisfactory answer to this and failed. I hope StackOverflow can deliver for me!
I am using SharePoint Foundation 2010 (my first real attempt to deep dive into SharePoint), with (among other things) a custom web part; the master page for the site uses a CSS file supplied by the client and to which I must adhere. The issue I am having is that SharePoint, by adding several SharePoint specific CSS classes to the web part HTML structure, is conflicting with the client's styling. After some digging, I've found that the ms-WPBody class and its various element selectors are the chief culprits.
I could add !important to everything in the client style sheet, but that is verboten. I could insert some very messy styling into the child content of the web part in an attempt to override the SharePoint styling, which is the course I've been pursuing of late, but it's been getting messy. Or, I could try to remove the class from the web part, which brings me to my question:
How can I remove or otherwise override the CSS class names inserted into the HTML structuring for a SharePoint web part? I don't know enough of the inner workings of SharePoint to know what to hook to make this change, and my google-fu is fail on the subject. CssClass on the ASP.NET web control markup is obviously ignored, probably some holdover inherited from WebControl.
Help me StackOverflow! You're my only hope!
Edit
I apologize for not making it clear before, but I would like to state that I grok CSS and am not looking for help with styling. What I really am looking for is how to remove the CSS class emitted by SharePoint. Can anyone help there? I'm going to remove the CSS tag, since that appears to be confusing people. This question isn't really about CSS, it's about SharePoint.
CSS has to match the html that it is applied to - with generated html like that produced by SharePoint (or standard asp.net webforms for that matter) it is usually far easier to modify the css. If adding important is not an option you can usually do something using more specific selectors - ie a style defined as "table td" will override one for "td" though they actually select all the same elements. You can use this approach to undo any bits of sharepoint styling that are causign issues.
If you really want to change the classes sharepoint puts on the page, use jquery - trying to do that server side is really not something you want to get into on your first sharepoint project.
I'm not sure I follow, but why not wrap your webpart in a container div and then style to your heart's content:
<style type="text/css">
.ms-WPBody {
background-color:red;
}
#myCustomCss p
{
background-color:Blue;
}
</style>
<div class=ms-WPBody>
<div id=MyCustomCSS>
<p>Hello world</p>
</div>
</div>
In 2007, we had to worry about making sure your stylesheet was named last alphabetically so that it was applied correctly. Prefix your css file with z to see if it helps.
Here's a reference article about the issue:
http://singchan.com/2009/12/29/branding-sharepoint-2010-collaboration-sites-part-2-in-a-series/
Here's some typical Web Part HTML:
<div style=""
allowexport="false"
allowdelete="false"
class="ms-WPBody ms-wpContentDivSpace"
width="100%"
id="WebPartctl00_m_g_d0420a1c_44b7_4009_81c9_2bbcf9b325e9"
haspers="false"
webpartid="d0420a1c-44b7-4009-81c9-2bbcf9b325e9">
<div id="ctl00_m_g_d0420a1c_44b7_4009_81c9_2bbcf9b325e9">
Web Part Content goes here...
</div>
</div>
The trick is that the Web Part itself is the inner DIV (and all its children). The outer DIV (the one with the ms-WPBody class) is the WebPartZone. This control is sealed, but you can write an Adapter that will render the WebPartZone however you want. Most of the examples are for table-less rendering, you could write one that maintains the existing structure, but removes the classes.
To me, coding all of that and then registering it in the compat.browser of App_Browsers for the Web Application seems like overkill, so I'd probably go with jQuery (but if you do the Adapter, I'd love see it).
Or just add a Content Editor Web Part and override the CSS style element in the HTML:
<style type="text/css">
.ms-stylebox {
border:o important;
}
</style>
-- Peace!
how are you loading your CSS file? IF you are loading it in part of the head of your master page, or through just setting a custom.css, you can try loading it outside of the head. This should cause it to load after core.css and therefore allow you to override the standard classes as needed.