Clear Sitecore XSLT Cache - xslt

Question: Can anybody let me know on how to clear a sitecore xslt cache?
Problem : We have implemented Main Navigation and Footer Navigation from the same items in Sitecore.We had a urgent requirement to remove an item from Main Navigation and Footer.
We removed the item from Main Navigation by unpublishing the item in sitecore.However footer is implemented using XSLT as below :
<sc:xslfile visible="true" runat="server" id="xslFooter" cacheable="true" varybydata="true" />
Now even though the item is unpublished,it is still visible in the footer of the site and my guess is, it is because of XSLT cache.So can you please tell me on how this can be done.
Note:I can't write any code for this now as I need to remove immediately from live site.Also I can't clear using admin tool as it clears cache for all users?
So any solution for this?
Thanks,
Suhas

If you go to /sitecore/admin/cache.aspx you will be able to clear the cache, but I assume this is the admin tool you don't want to use.
You say that you don't want to clear the cache for all users, but I can't see a way around this because the cache is not user/visitor specific.
If acceptable, you can also clear the XSL cache by renaming/updaing/adding a file in the XSL folder.
The issue has been discussed here:
Sitecore XSL cache

Related

What is Sitecore Datasource and why should use?

I'm new to Sitecore XP 8.2 and try to study by articles and youtube.
However, I can't figure out why we should use datasource, instead of having multiple items in the content tree? How can I enable Global on the content tree?
If you by 'datasource' means 'Rendering Datasource Location' heres a real life example, where using datasource is helpfull, instead of having data items underneath each page item.
Lets say, you have a Footer module, which you would like to include on all content pages in your website. And the Editors should be able to change the content of the footer module on all pages, but the effect should be global.
In this case, could a solution be, to make a folder at the top of your tree structure called 'Shared Modules', and point the 'Footer Rendering Datasource Location' at this folder.
In case an editor changes the footer text on the main page or a subpage, the effect will allways be saved in the same location.
unlike, a 'Texbox module' which you would like to have multiple of on multiple pages. these would you like to have placed underneath each of your content pages in a folder e.g 'Page Modules'.
You can use Sitecore Datasource for a variety of reasons. One of the reasons is to use this instead of context item so that you can refer to another item in Sitecore content tree. Another good reason is to personalize your content or run the A/B testing, content testing. Using Sitecore datasource, make different parts of page componentize and all this helps content editor to improve experience in content editor.
For some good information on using Sitecore datasource, you can look at
https://www.linkedin.com/pulse/how-improve-experience-editor-sitecore-number-ways-rohit-chopra
https://www.linkedin.com/pulse/sitecore-personalize-content-conditional-renderings-sub-rohit-chopra
In short, with datasources you can re-use your items, makes your life much easier if you want to go with personalization and its easier to manage in terms of security/workflows.
A datasource is a pointer from your presentation to a content item. This item can easily be picked from a global or local placement in the content tree. You can still navigate from the datasource to other items (like subitems) if you want a more complex structure for your content.
The advantages of using datasources, is that Sitecores presentation engine, Experience Editor and marketing/personalization is based on the usage of datasources. Further you cater for reuse of content, as multiple presentations can point to the same datasource item.
By using datasources you decouple the content from the structure of your content tree and hierarchy.

Joomla 3 - insert custom field in article editor

I inserted a custom field in the article edit page in the administration - I changed two files:
In /administrator/components/com_content/models/forms/article.xml
I added a field subtitle
<field name="subtitle" type="text" label="Subtitle"
description="Add a subtitle here" class="inputbox" size="30"
required="true" />
and in administrator/components/com_content/views/article/tmpl/edit.php
I added
<?php echo $this->form->getLabel('subtitle'); ?>
<?php echo $this->form->getInput('subtitle'); ?
Now I've created my custom field. But I have to store the values in the database when I input and save something, how does it work?
Can anybody help me?
Thanks
If you add a field to the #__content table, it will probably be saved automatically. However I would not do that. You never know what an update does and you don't want to loose data.
If you look at /administrator/components/com_content/controllers/article.php you find a function called postSaveHook. This is where you can process the data further. There you could store your subtitle into an own table.
Anyway, you would need to apply those changes after each Joomla update, as it's likely that those files are overwritten.
I know the question is not recent, but as others may find it I think it is important to clarify something.
By extending the article's form xml in the way you describe, you are hacking the core files. This is bad practice and should be avoided. As Bakual explained, these changes are likeky to be overwritten with an update of Joomla.
Not updating Joomla when new Security updates are released is even worse - don't go there.
What you should have done is extending the article's form xml in a way that doesnt interfere with core files. This article given an example on how to go about this: http://docs.joomla.org/Adding_custom_fields_to_the_article_component

How to select only published items in XSLT-Umbraco?

i have a photo slider,there is next and prev buttons ,and when you click on a button,a pop-up window appears and show the big size of photos.Im using Umbraco,the xslt macro shows the nodes within the Gallery folder.xslt selects "Gallery/Photo" nodes.When i upload a photo,if i dont publish it,the sliders's next/prev buttons dont seem and pop-up dont work.How can i select only published items in Xslt ? Thanks in advance
I see this debate has sprung up again. It's not a direct answer to the problem, but should you understand Umbraco a little better ...
Umbraco & XSLT
Although Umbraco runs all it's data predominantly from a MS SQL database, it does however cache this data everytime a page is published/unpublished within a "hidden" XML file. It frees up the developer of any direct XML editing and leaves it to Umbraco. However, this makes it easy for a developer to forget or not even know it's there.
The file can be found in either of the following locations, dependant on which version you are using:
~/App_Data/umbraco.config
~/config/umbraco.config
The Problem
The XSLTs run using the umbraco.config file as it's XML source. However, this file will only contain published nodes. Unpublished nodes will be removed from the XML completely, so the XSLTs shouldn't be able to access unpublished nodes at all.
I suspect the problem may have to do with something other than unpublished nodes.
Without seeing your XSLT its difficult to guess what you're doing. However as #Goran states, XSLT in Umbraco can only access published nodes. This is because the data the XSLT has access to is the cached XML structure found in umbraco.config.
So, what is probably happening is that you actually want to exclude nodes that don't yet have an image assigned (even though the node itself is published).
You can do this using something like:
$currentPage//GalleryNode [image != '']
This will select all the GalleryNode elements under the current page that have an image property assigned.
If this is the case, you may want to consider making the image property mandatory to prevent any nodes from being published without an image.

Why is the review section of my Magento product page not showing?

Somehow the review section / tab on my product pages is not showing up.
The Reviews tab section is totally empty. What could be the culprit?
I have enabled 'Price', 'Quailty' and 'Value' in Catalog -> Manage Ratings and refreshed all cache. But it still doesn't show up.
And I checked the catalog.xml in the layout folder of the current theme and the 'reviews' section IS there:
<action method="addTab" translate="title" module="review">
<alias>reviews</alias>
<title>Reviews</title>
<block>review/product_view_list</block>
<template>review/product/view/list_tab.phtml</template>
</action>
And I double checked, /home/my_user/public_html/app/design/frontend/default/my_theme/template/review/product/view/list_tab.phtml is there and the content of it seems quite all right. It's the review and rating form no problem.
I installed some other themes on princessly.com. Could it be them that some of the template / layout files got overwritten?
Thanks a lot!
Well the module is working and enabled as you can see the link at the top.
Other themes shouldn't have overwritten anything as they should all be contained within their own theme folders.
It looks like some variation of the modern theme, and since you have the Review tab I assume you have it added in the layout file. Is the template it refers to there correct? And have you checked the file to which it refers?
So for example, in my catalog.xml file I have the following adding the description tab:
<action method="addTab" translate="title" module="catalog">
<alias>description</alias>
<title>Product Description</title>
<block>catalog/product_view_description</block>
<template>catalog/product/view/description.phtml</template>
</action>
Do you have something like this adding your review tab?
Problem solved. Just as I suspected, it is one of the other themes that has a module getting higher in the templating priority than that of the current theme. Renamed that module's directory name and refreshed cache. Now the reviews section is correctly showing up.
Magento is much too flexible in customizing the whole store. Unlike WordPress, where a theme has no privileges other than residing in ONE folder, Magento themes come with folders and files that can overwrite almost the entire installation, making them easily entangle with each other, resulting in unpredictable problems that are hard to trace.
Recommended practice is to install as less themes on the same Magento installation as possible. I just installed 2 and that's enough for this problem to occur that wasted me 5 hours.

Include a page in the template script in magnolia cms

How can I include a page from magnolia into a magnolia template script?
In the template script with I can access data from a specific page, but how can I load that page into the template?
Let's say I have 2 pages each with its own template. Page 1 contains in its tree page 2. I want to include in the template script of page 1, page 2, but doesn't work.
Thank you very much :)
UPDATED
What I actually want to do is include my header in all of my project's pages. But I don't want to put it as a paragraph, because if I ever want to change my header, I'll have to edit all the project's pages.
So what I try to do and I don't know if this is the correct approach is to create a page template for the header. This template won't include any , or css, it's just the code for the header.
The next thing I want to do is create a page in magnolia with that model to be the header.
Next I'd like to include the page I've just created in my main template model for the project, but I can't figure how to do that.
I am new to Magnolia cms and initially I tried creating my demo site using stk. The only problem was that I couldn't use jsp as a scripting language, or at least I couldn't find any solution on the internet. I don't really know freemarker, but that's not really a big problem. I'm really reluctant in using freemarker because maybe in the future in a more complex project I might need some features that freemarker doesn't support, but jsp does. I'd like to build my site using jsp if that's possible with magnolia.
I'm sorry for this long update, but if anyone has any suggestions on what a best practice could be and if I could implement what I want in jsp I would be really grateful.
Thanks again for you time :)
If you're using the STK then see this guide on content-reuse.
If not have a look at the cms tag-lib, especially the tags cms:loadPage and cms:setNode with which you can get a piece of content and set it as a JSP/JSTL variable and then render it using cms:includeTemplate.
A common scenario is to 'inherit' content from the parent page, the header is an excellent example of this. What you do is for an area you walk up the content hierarchy and render everything from the parent pages in their area with the same name. This way the header which you've only added to the top page is included in all its children.
Another option is to a have special page which simply holds things to be included in other pages. Like header, footer and banners that should go in the side pane of some pages.
Including a page within another page doesn't really work. Page 2 already has its own <html> tags, its own <script> tags, and its own CSS, so including it wholesale into another page just simply doesn't make sense.
You do, however, have a couple of options:
Use an iframe. This will allow you to include the entirety of Page 2 in a region of Page 1.
More recent versions of Magnolia will allow you to render an individual paragraph, which you could then include in another page. (For example, you can see a single paragraph from http://demopublic.magnolia-cms.com/demo-project/about/subsection-articles.html at http://demopublic.magnolia-cms.com/demo-project/about/subsection-articles/article/main/0.html.) This requires knowing a bit about the way the data is structured, but is a pretty useful way to be able to selectively extracts bits of a page.
You can use the Magnolia API in your model class to pull data from sub-pages, and then make it available to your view template. This is the approach the STK uses to build teasers that include content from the pages they reference, and is probably the most powerful and flexible approach, but it does require actually writing some Java code. (See http://documentation.magnolia-cms.com/templating/stk/templating.html and http://documentation.magnolia-cms.com/reference/templating.html for details of how to use this approach.)
(Added after question was edited) The footer functionality that's included with the STK does almost exactly this. You might be interested to take a look at that and see how it's implemented there.
Hope that helps a bit!