I have come accross a strange problem where magento seems to have stopped writting the Active and Active parent classes onto my menus.
I have been using the default Magento menu and it has been working for a month or so fine. I have cleared the cache and re-indexed the categories and products.
Any advice appreciated.. could this be a file permision problem ?
for me this xml change in my local.xml solves the issue:
<default>
<reference name="catalog.topnav">
<action method="unsetData"><key>cache_lifetime</key></action>
<action method="unsetData"><key>cache_tags</key></action>
</reference>
</default>
Followed Benmarks advice, Disabled the Block Html Caching and the active class was being written again.
Magento's HTML Block caching is a rather strange beast. They've only enabled a few blocks to work with it, one of which is the top menu (the template file is different depending on which version of Magento you're using).
If you want to keep block caching on and get rid of this bug, then you could create a module with a new block type which
extends Mage_Catalog_Block_Navigation
and set the following data in your block's _construct() method:
$this->addData(array(
'cache_lifetime' => null,
'cache_tags' => array(Mage_Catalog_Model_Category::CACHE_TAG, Mage_Core_Model_Store_Group::CACHE_TAG),
));
This sets the cache time to null, ie disables it.
Then, in your layout files you'll need to find (in page.xml) the Navigation Bar. It will have the following tag:
<block type="catalog/navigation"...
Which you'll need to replace with your own module's navigation block class:
<block type="mycompany/navigation"
Refresh your caches, and you should find your classes behave properly. For more information on Magento's layout I really reccommend Alan Storm's excellent book 'No Frills Magento Layout', and for a great addition to your Magento debugging tools check out this module which shows you which blocks are being cached (as well as a whole load of other useful block info).
Related
I'm using Symfony2 with Twig templating engine.
Is there any way to output a list of all Twig templates files loaded in the current request, including the ones loaded through extends, include, etc.?
That would make my life much easier when overriding third-party bundles' blocks, but I can't find a way to do it.
I've been looking for such a tool for a long time but never found it... The debug options of twig are very limited, and there is no tool in the sf2 dev bar dedicated to it...
I always add twig or html comments on top of each of my templates to get an idea of where I am and why during development or on the final page.
You can try this code, it puts filenames in HTML like this:
<!-- START templatename.html.twig -->
...
<!-- END templatename.html.twig -->
I know, that it is not a good solution, but it is better than nothing.
not a problem when you are working in dev in app_dev.php
expand bottom SF toolbar, click on 200 status or on #your_rote_name
you will redirect to smt like localhost/_profiler/s0meha5h?panel=*
then click on left menu on TWIG then url will be like localhost/_profiler/s0meha5h?panel=twig
and you will see all templates like FolderYourBundle:Folder:twig_file_name.html.twig that loads one by one!
We have followed the guide provided by WSO2 to get access to the CSS / JSP pages.
Our aim is to re-theme / rebrand / restyle the login page. We have found that the login page is part of the jar: WSO2\repository\components\plugins\org.wso2.carbon.identity.sso.saml.ui_4.0.3.jar
The login page is called login_ajaxprocessor.jsp
The guide mentioned above states the following about JSP's ending with _ajaxprocessor.
By default when create a jsp file ( say “foo.jsp”) in a Carbon UI
component, it will inherit header, left menu and footer from the
Carbon core UI. But if the file name is “foo_ajaxprocessor.jsp”, there
will be no inheritance.
For an example let's consider, “login_ajaxprocessor.jsp” in
“org.wso2.carbon.identity.saml.sso.ui” component. It simply omit the
header, left menu and footer and display only the content from this
file. So we are able to customize this page in to a different look and
feel.
Were were successful in modifying the language (buttons, etc) in the JSP files. This Jar also contains a CSS file in: \web\sso-saml\css\main.css
We have modified this CSS file to my own style. However, when the page gets loaded, it seems the default WSO2 main.css file is read.
When looking at the default way in which the JSP page refers to the CSS, it says:
<link media="all" type="text/css" rel="stylesheet" href="carbon/sso-saml/css/main.css"/>
We would expect that the /sso-saml/ part wordt select our own modified CSS file.
Is it possible to configure that for this page only, our modified CSS file will be used? We want to prevent to have to change the default main.css. Also, it is because we want to use specific images, that we want to store in jar\web\sso-saml\images
Yes you can use your custom style pages and apply them. Please refer [1] [2] for more info. This will guide you on your task.
Hope this will help you.
[1] http://wso2.com/library/knowledge-base/2010/11/customize-ui-theming-wso2-carbon-based-products
[2] http://wso2.com/library/knowledge-base/2011/11/playing-around-carbon-product-themes
The login.jsp can be found in following jar.
/repository/components/plugins/org.wso2.carbon.ui_4.0.5.jar => /repository/components/plugins/login.jsp
and css => /repository/components/plugins
I'm using Plone 4.2. I had the need to manage imagemaps in my application so I installed the following product: http://pypi.python.org/pypi/zopyx.tinymceplugins.imgmap. This product uses TinyMCE to edit the images and add links to them.
After installing this product, I noticed that I am now unable to view my TinyMCE controls while editing a content type. Looking at my browser's error console, I notice that all my *.kss cannot be read. This is the error that is displayed for all *.kss files:
Error: The stylesheet http://localhost:8082/plone/portal_kss/My%20CMS%20theme/++resource++tinymce.kss/tinymce.kss was not loaded because its MIME type, "text/plain", is not "text/css".
Source File: http://localhost:8082/plone/folder-test/image-maps-test/page-with-imagemap/edit
Line: 0
I do not understand why there should be error regarding the MIME type. Anyone has a clue on how to fix this?
Additionally, I get the following:
GET http://localhost:8082/plone/portal_javascripts/My%20CMS%20theme/plugins/imgmap/editor_plugin.js 500 (Internal Server Error)
Just to answer my own question:
I opened the product's skins.xml file
(i.e. zopyx.tinymceplugins.imgmap-0.3.1/zopyx/tinymceplugins/imgmap/profiles/default/skins.xml)
This is how it looks like:
<?xml version="1.0"?>
<object name="portal_skins" allow_any="False" cookie_persistence="False">
<object name="zopyx_tinymceplugins_imgmap"
meta_type="Filesystem Directory View"
directory="zopyx.tinymceplugins.imgmap:skins/zopyx_tinymceplugins_imgmap"/>
<skin-path name="Plone Default">
<layer name="zopyx_tinymceplugins_imgmap"
insert-after="custom"/>
</skin-path>
<skin-path name="Sunburst Theme">
<layer name="zopyx_tinymceplugins_imgmap"
insert-after="custom"/>
</skin-path>
</object>
It appears that the product has been geared towards specific themes.
Now, my application has a custom theme i.e. MyCustomTheme. When I inspect my portal_skins
Site > Zope Management Interface > portal_skins > properties
I notice that indeed the "Sunburst Theme" has included the zopyx_tinymceplugins_imgmap skin layer in the 'Plone Default' and 'Sunburst Theme', but NOT in my 'MyCustomTheme'. It has added it right after the custom layer.
So I go ahead and manually add zopyx_tinymceplugins_imgmap in MyCustomTheme, just immediately after the custom layer.
This manages to fix it, and I can now view my TinyMCE controls. I believe there must be a better way to have it work.
Hope this helps someone in future.
UPDATE: See this for a better solution.
How Can I appends a querystring parameter to each CSS and JavaScript include in the HTML to clear CSS and JavaScript cache.
I have tried
<action
method="addCss"><stylesheet>css/style.css?123</stylesheet></action>
and
<action
method="addItem"><type>skin_css</type><name>css/styles.css?123</name><params/></action>
.
But each time it returns a the base package like
http://www.example.com/skin/frontend/base/default/styles.css?123
not my custom theme directory .
How to solve this ?
This free extension should do what you want - works perfectly for me:
https://github.com/jreinke/magento-suffix-static-files
When you're adding a css file through xml layout updates, the addCss action (which realy just calls the addItem action with the type set to skin_css) is looking for a file path, not a url. While query strings are valid in urls, they aren't in file names. Magento sees that as an invalid parameter, gets confused and falls back to base/default.
I can think of 2 solutions for this. Unfortunately both are kind of hackey.
Move the css file to the base default theme. This works but it depends on fallbacks that might not stay the same in other versions of magento.
instead of directly inserting the css file, create a phtml template file with the html code to insert a css file. Then insert a core/template block with that new template file as its template in the layout xml. I've used this method on the sites i develop for to work around this problem.
Here's what we do:
<reference name="head">
<block type="core/text" name="link.tags">
<action method="setText">
<text>
<![CDATA[<link rel="stylesheet" href="/css/style.css?v=2">]]>
</text>
</action>
</block>
</reference>
Got this idea along with some other useful stuff from 5 Useful Tricks For Your Magento local.xml.
As an alternative, you can always just rename the file from style_v1.css to style_v2.css etc. whenever you make a change -- it has the same effect as changing style.css?v=1 to style.css?v=2.
as a follow up answer to this question i found the following (paid) magento extension which does what you require:
http://www.magentocommerce.com/magento-connect/clear-css-and-javascript-cache.html
To get a one-off view on a Plone folder I do something like this (not all code shown):
In configure.zcml:
<!-- Marker interface. Set this on the folder through the ZMI
interfaces tab.
-->
<interface interface=".interfaces.IMySpecialFolder" />
In browser/configure.zcml:
<!-- Special case view. Set as the folder's view through the ZMI
properties tab (layout property).
-->
<browser:page
for="..interfaces.IMySpecialFolder"
name="special"
template="special.pt"
permission="zope2.View"
/>
This works great, but I would like to control the folder's display menu to list only my special case view. I can add it, and it shows up only on my marked folder, but I have to change the site-wide ATFolder FTI.
In browser/configure.zcml:
<include package="plone.app.contentmenu" />
<browser:menuItem
for="..interfaces.IMySpecialFolder"
menu="plone_displayviews"
title="Special view"
action="##special"
description="Special case folder view"
/>
In profiles/default/types/Folder.xml:
<?xml version="1.0"?>
<object name="Folder">
<property name="view_methods" purge="False">
<element value="special"/>
</property>
</object>
Of course I cannot remove the existing available view methods without affecting every folder on the site.
Is there a way to do this one-off display menu tweaking without changing a content type's FTI?
Actually, it seems like this problem has been tackled before. p4a.z2utils patches CMFDynamicViewFTI to get the list of available views from an IDynamicallyViewable adapter lookup. (dateable.chronos uses this mechanism for its folder calendar views). So my question becomes:
Is there a way to do this one-off display menu tweaking without changing a content type's FTI and without patching Plone?
The plone display menu builder uses ISelectableBrowserDefault to get available options in the Display menu (see
http://dev.plone.org/plone/browser/plone.app.contentmenu/trunk/plone/app/contentmenu/menu.py#L220)
So I think (but I haven't tried this) that if you define an adapter for a more specific interface (in your case IMySpecialFolder) that provides the Products.CMFDynamicViewFTI.interface.ISelectableBrowserDefault it should work.
The adapter should have the methods required by plone.app.contentmenu.menu.DisplayMenu above.
Answering my own question, I've realised that the most straightforward way to achieve one-off folder views is to follow the pattern Plone itself applies in the Members folder: a PythonScript index_html that calls the custom view, e.g.
member_search=context.restrictedTraverse('member_search_form')
return member_search()
Products.CMFPlone illustrates how to setup such a PythonScript with a GenericSetup import handler.
In retrospect I realise I didn't need the marker interface in my question scenario. It's not necessary here in the answer either.
Note that this solution doesn't result in "the folder's display menu listing only my special case view" as I asked, but does away with the display menu altogether. I'm fine with that.
One way you could have solved it is using traversalhook to register menu items, or in this case, unregister menu items, or register menu items with conditions that make them not appear. With the traversal hook you can use a marker interface to make it just happen in a certain folder, subsection or page.
You can see where we implemented similar code here
https://github.com/collective/collective.listingviews/blob/master/src/collective/listingviews/browser/views/controlpanel.py#L105
In this case we just wanted to register new display menu items dynamically based on control panel configuration.