I've recently started making a website using the X-Cart platform.
I've read some of pages from the official documentation, but a lot of things do not match the current version of X-Cart (5.3).
From what I understand, they switched from Smarty to Twig, but the file locations and hierarchy have changed as well. Even the database structure is modified and old tables don't have the same names.
I'm currently trying to entirely replace the header / footer of my website. The HTML files are included in lists and displayed with twig, but I don't know how to find those specific files.
Also, I've used the Webmaster Kit add-on in order to find the templates. The problem is that every single element displayed on the page is built from multiple places. Most of them can be found in /customer/layout/, but are part of lists such as layout.header, so the twig files only include the wrappers and retrieve the rest of the code from the database, at least that's my understanding of the situation.
{##
# Header logo
#
# #ListChild (list="layout.header", weight="100")
#}
<div id="{{ this.getUniqueId('logo') }}" class="company-logo">
<img src="{{ this.getLogo() }}" alt="{{ t('Home') }}" />
</div>
I tried accessing layout.header through my database, but the table shown in the documentation doesn't exist anymore.
Could someone please explain the hierarchy and guide me through the steps to create a custom header / footer ?
I did create my costum module, but I still don't know which files are the right to edit in order to make changes happen on my website.
Thank you, let me know if you need additional details.
The header section is defined by the skins/customer/layout/header/main.header.twig template or you can just assign all needed templates to layout.header view list and it will have the same effect. You may also want to remove existing templates and viewer classes from this list.
All these procedures are explained here:
http://devs.x-cart.com/en/getting_started/step_2_-_applying_design_changes.html
http://devs.x-cart.com/en/design_changes/basic_guide_to_theme_creation.html
If you want to look up what templates and viewer classes are in the list, then you can run following MySQL query:
SELECT * FROM xc_view_lists WHERE list="layout.header";
As for footer, the layout.footer defines this area or just override the skins/customer/layout/footer/main.footer.twigtemplate.
Hope, it helps.
Tony
Related
I am in the process of experimenting with Pico CMS which uses a flat files organized in hierarchical folders and Twig as its layout engine. I have studied the Twig documentation and looked at a few example templates. One of the things I have consistently found is the way they incorporate meta data. Here is one example
---
Description:Page Description Placeholder
---
in the markdown file, say index.md, and then
<meta name="description" content="{{ meta.description|striptags }}" />
in the corresponding Twig template, index.twig
I understand what is happening here. However, my attempts to find a description for this way to handle meta data have failed. I may well be looking for the wrong thing or have somehow managed to miss this in the Twig docs. I'd be most grateful to anyone who might be able to put me on the right track
I want to custom the output HTML code of CQWP and I do not want to see <table class="s4-wpTopTable">...</table>. But even I try to edit ContentQueryMain.xsl file by the help of this article:Customizing the HTML code of a Content Query Web Part, the table is still there.I can't even find any code generated the table which class is "s4-wpTopTable".
So ,I need some talent guy to tell me how to stop the CQWP to generate TABLE.
I have tried to set the Content Query Webpart's SuppressWebPartChrome to "True",but the table is still there, such a big problem.
I faced problems like you had and I decided to develop a web part that makes it easy to customize the look & feel of a portal. You can find detailed information about it here: Item Lister Web Part
If you want to customize the output HTML of CQWP,you should:
Insure your CQWP is NOT in the webpartzone, because the webpartzone will make the the SuppressWebPartChrome does not work for your webpart.
Insert your webpart to the page with the help of SPD,and then in the code view,you can change the SuppressWebPartChrome of CQWP to True(Defualt is False).
Look at the source code of your page,the <table class="s4-wpTopTable">...</table> is not there now, cool!
Anyother addtionnal code generated by sharepoint of the CQWP,you can custom it in your ContentQueryMain.xsl file, so you should learn the language--XSTL .Don't be afraid of it,it is so easy for you to learn in one hour.
I´m trying to understand how the use of the stash plugin will affect the URls of my site.
The traditional way:
I have a template group called site. Within the TG site I have the templates articles, about_us, etc.
The URl will for a single entry be
www.mysite.com/index.php/site/articles/title_of_respective_article
URL for the About-us-page:
www.mysite.com/index.php/site/about_us
Both will reflect the template_group/template structure and thus be SEO-friendly and give users a hint where they are on the site.
But when I use stash I will have 2 wrappers (one for the homepage and one for the rest of the site.
Partials will be used for header, main content and footer.
As far as I understand it, I´ll use the template_groups layout for the wrappers and partials for the main content.
The templating look like
Two wrappers build the TG "layout" Both are hidden, since they should´nt be called directly.
layout
.homepage
.site
Three partials in the TG partials
partials
header
main_content
footer
And by the way shouldn´t those not also be hidden, since they aren´t complete HTML-pages either.
This is what confuses me. How do I get my nice URLs back?
A URL like
www.mysite.com/index.php/site/about_us
will not match the TG/T concept anymore.
Any help?
To expand on both their answers above, and just to be specific to your www.mysite.com/index.php/site/about_us request:
You'd create a template group called "site" and then you may alternatively have something like this code in the /index template
{embed="layout/.site"}
{exp:channel:entries limit="1" disable="categories|member_data|pagination"}
{exp:stash:set name='title'}{title}{/exp:stash:set}
{exp:stash:set name='maincontent'}
<section>
<h1>{title}</h1>
<article>{content}</article>
</section
{/exp:stash:set}
{/exp:channel:entries}
The embed calls the .site layout and the interior simply pulls your specific channel:entries data.
As you can see, it's still using the traditional templategroup/template ways of building URLs, it's just pulling data differently.
When using Stash and the template partials approach (which I don't use personally), the files you mention are all embedded. You still use the same template groups and template files as before.
The Stash-based approach is simply a different way of doing things within your existing templates - not a replacement for them.
Exactly as Derek says. The way to think about it is this - with the template partials approach, your templates contain mostly (if not only) the entries logic (channel entries loop, its parameters, what custom fields are in play for that channel, etc). The outcome of the logic gets stores as stash variables. The stash variables then get called upon by your embedded layout templates to display the content you've stashed. So your URL structure remains the same, but you have considerably less duplication of effort since the more you constrain your templates to logic (i.e. very little if any formatting/display markup) the cleaner they are and the easier it then is to manage your templates.
I know this sounds crazy, but I need to show some post information outside of the loop in the expression engine channel module. Is this possible?
You could use EE's SQL Query template tags (if you know, or have access to the database table names and know what to look for in the database):
http://expressionengine.com/user_guide/modules/query/index.html
Basically, you'd output only what you need - it doesn't have to belong to a channel, or anything specific. The one kicker is that you'd have to know the basics of SQL syntax, but if you have a small working knowledge of it, you can do tons of additional things with it.
If you're not keen on SQL, you could simply embed a template within the template that you're working on. Here's a simple example that assumes you're editing the index and meta templates inside of a template group called 'news':
index template contents:
{exp:channel:entries channel="news"}
<div class="entry">
<h1>{title}</h1>
<div class="content">{body}</div>
{embed="news/meta" this_entry_id="{entry_id}"}
</div>
{/exp:channel:entries}
meta template contents:
{exp:channel:entries channel="news" dynamic="no" limit="1" entry_id="{embed:this_entry_id}"}
<div class="meta">
<p>{entry_date}</p>
<p>{author}</p>
</div>
{/exp:channel:entries}
As you can see, the index template is embedding the meta template. Note that we're passing a parameter to the meta template so that it knows which entry ID to print information about. If you're unfamiliar with EE's template embedding feature, you can read more about it in the EE docs. Embedding templates in other templates is a great way to access the {exp:channel:entries} loop multiple times.
There's an add-on called MX Jumper that allows you to "set" a variable from inside your entries loop and then "get" it elsewhere in the template (before or after in the HTML loop doesn't matter because it parses later).
Alternatively, the approach that's all the rage now is to use the add-on Stash to store any and all elements you need to use distinctly as stash variables that you set and then get - similar to the above, except that once you set them, getting them has to happen at a later parsing stage. The beauty of this approach is stash will store the "set" variables for reuse either at a user or site level, and you can determine what the expiry period is - which then results in better performance. When you apply this broadly using the "template partials" mindset, you can store everything with stash, and then call them into a small number of wrapper templates. This makes it possible to use stash to set, for example, your entry title, then get it three separate times in the wrapper template without any additional load - no need for separate loops within your template - one loop to set the variable, and then you can call that variable as needed in your template - it's kind of like creating global variables on the fly.
I would also suggest looking at Stash.
We are creating a site template that among other things has a Document library with MANY sub folders and a Link list that contains shortcut links to the depths of the DocLib. While making the Site template we are checking the box to 'Include Content.' We are using Sharepoint 2010. No MOSS.
Our problem: Once we make a site from the template, the shortcut links don't work. While the first part of the link URL is rewritten, there is a portion of the original site name still buried in the URL.
My Question: Is there a way to create a relative links to content inside of the site, so that the the site name isn't included? or is there a variable I can use to represent th current site? or do I have to programmatically 'fix-up' the links after it's created? or some other better option?
There is a way, but you will have to do your work in master pages. The following tag is rendered in a sharepoint 2010 master page as ahref, and the relativity is passed on to sites created as templates.
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/SitePages/dashboard.aspx" id="v3idNavLinkTrackerDash" Text="Now is the time for all good men." />
I think you may have come across one of the many limitations of using templates. I don't know of any way to change this behavior when using templates.
However, you mentioned programming. If you are deploying customizations, you might look into site definitions or feature stapling with code to populate the list.
On the no code side, you might have some options if there is some flexibiility in execution of the site. If you really need the sub folders and the template method, you might look at replacing the link list with a page. If the page content is a list of links, they will be relative. If your structure is flexible, another option is to remove the sub folders. You could add a field for category that you can group by instead. Or, you could create seperate document libraries instead of using folders.