Is it possible to override template located here /app/design/adminhtml/default/default/template/ (e.g. /app/design/adminhtml/default/default/template/customer/edit/js.phtml) by creating a new module in community pool?
So the thing is that I don't want to override it by placing the file (or anything) in local pool.
Is it possible to do that by extending of appropriate block class or something like that?
I've created the same file in /app/design/adminhtml/default/my_directory/template/ and extended Mage_Adminhtml_Block_Customer_Edit class in /app/code/community/MyCompany/MyModule/Block/Adminhtml/Customer/Edit.php and don't have an idea of how to solve this.
In your modules' config (app/code/community/MyCompany/MyModule/etc/config.xml) add the following section:
<adminhtml>
<layout>
<updates>
<mycompany_mymodule>
<file>mycompany_mymodule.xml</file>
</mycompany_mymodule>
</updates>
</layout>
</adminhtml>
This will make mage look for a new file in app/design/adminhtml/default/layout/mycompany_mymodule.xml which should look something like this:
<?xml version="1.0"?>
<layout>
<adminhtml_customer_edit>
<reference name="customer.edit.js">
<action method="setTemplate">
<template>mydirectory/edit/js.phtml</template>
</action>
</reference>
</adminhtml_customer_edit>
</layout>
And then work on your file app/design/adminhtml/default/template/mydirectory/edit/js.phtml. There is probably no need to replace/extend the current block because it is already doing a good job as it is.
Related
My url may or may not have a certain parameter and I set the action class for such a url as follows :
<action name="{paramOne}/{paramTwo:myparam*}/details"
class="myaction"
method="execute">
<result name="success">/mypage.jsp</result>
</action>
So the url something/myparam/details is working but when i try to invoke something/details (which according to struts.xml should work). It shows that there is not action class mapped.
your code '*' only can match between "{paramOne}/" and "/details"
so you must have something between "{paramOne}/" and "/details"
You want to route different URI patterns to the same action, this is exactly the case action mapping is made for.
I think the best solution is to write two separate statements.
If you don't want to repeat the "code" inside the <action> tag you can chain it (it's a kind of internal redirect, a kind of aliasing)
<action name="secondpattern" class="com.opensymphony.xwork2.ActionSupport">
<result type="chain">firstpattern</result>
</action>
https://struts.apache.org/docs/action-chaining.html
I'm trying to use Slow Cheetah to transform a Windows scheduled task config file. I'm simply trying to add "repetition" node information, like so:
ORIGINAL:
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2013-01-02T09:32:12.2196371</Date>
<Author>xxx</Author>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<StartBoundary>2013-01-10T01:00:00</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>
.....
</Task>
REQUIRED, ADDITIONAL XML
<CalendarTrigger>
<Repetition>
<Interval>PT300S</Interval>
</Repetition>
</CalendarTrigger>
To do this, I have the following transformation file:
<?xml version="1.0" encoding="utf-16" ?>
<Task version="1.2">
<Triggers>
<CalendarTrigger xdt:Transform="Insert">
<Repetition>
<Interval>PT300S</Interval>
</Repetition>
</CalendarTrigger>
</Triggers>
</Task>
The problem I'm having is that all attributes outside of the CalendarTrigger node are removed (and therefore making the resultant transformation config an invalid scheduled task format).
I have tried adding
xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xdt:Transform="SetAttributes" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"
to the Task node, but the attribute is then generated at CalendarTrigger level (and I cannot put this attribute on the original, because I then get "No element in the source document matches '/Task/Triggers' ").
Any pointers?
UPDATE:
The problem seems to be isolated to the xmlns attribute; if I try to include this in the 'Task' node of the original, I get "No element in the source document matches '/Task/Triggers'" - BUT changing this attribute to 'xmlns2' works fine and produces exactly what I need (albeit with an 'xmlns2' attribute!). Is this a known limitation of Slow Cheetah? Anyone know of a potential work-around?
That's because your xdt:Transform="Insert" is one level to high.
This should work:
<?xml version="1.0" encoding="utf-16" ?>
<Task xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<Triggers>
<CalendarTrigger>
<Repetition xdt:Transform="Insert">
<Interval>PT300S</Interval>
</Repetition>
</CalendarTrigger>
</Triggers>
</Task>
I've copied the default Magento theme in the two dirs and renamed it.
After a lot of tweaking I've come to a point where I'm stuck.
I've got a 3columns.phtml file where the basic layout resides:
top (top.phtml)
header (header.phtml)
main (main.phtml)
footer (footer.phtml)
with main.phtml:
left.phtml
middle.phtml
right.phtml
Now when I referenced these blocks separately in the 3columns.phtml with the getChildHtml() function everything was peachy. Now, after putting them in the main.phtml file it doesn't seem to work anymore. Any content in the main.phtml is not shown (not even simpel html tags). Thinking it could have to do with the xml layout files I looked into page.xml but found out some things are handled by catalog.xml
I now have these block declarations in page.xml:
top (no template= set)
header (no template= set)
main (template="page/html/main.phtml")
left (template="page/html/left.phtml")
middle (template="page/html/middle.phtml")
topmenu (template="page/html/topmenu.phtml")
breadcrumbs (no template= set)
right (template="page/html/right.phtml")
footer (template="page/html/footer.phtml")
And eventhough top and header have no template set their html shows up fine in the frontend. the footer shows up fine too.
Left's output is shown, but not wrapped by main's output.
Right's output the same.
Middle's output shows, but any getChildHtml calls in it don't.
Any ideas as to what's going on?
Also, how do the page.xml and catalog.xml relate to the template? Does every single call to getChildHtml have to be in the page.xml file? what's the difference between page and catalog.
The part of page.xml: http://www.snipplr.com/view/66919/part-of-pagexml-not-working/
The part of catalog.xml: http://www.snipplr.com/view/66920/default-part-of-catalogxml-not-working/
The 3columns.phtml: http://www.snipplr.com/view/66921/main-theme-file-3columnsphtml/
For the detail explanation you can read Alanstorm's book, "No Frills Magento Layout".
I'll give you "brief" explanation so that you have a little enlightment.
In our controller, when we call $this->loadLayout();, it will automatically "call" <default> handle.
Later, all of the handle in all layout xml will be merged.
Let's say you have <default> in page.xml, then you also have <default> in your catalog.xml.
After the call of $this->loadLayout() those <default> from page.xml and catalog.xml will be merged.
That's the relation between them.
We can say <default> is the main of everything. It is the main structure. Any other layout usually "referencing" from it.
Let's say you want to add something in the main body (content), we will call:
<reference name="content">
<block type="core/template" name="testing" template="some/test/template.phtml"></block>
</reference>
Those tag means: Put <block type="core/template" name="testing" template="some/test/template.phtml"></block> under block with name content.
If you see the definition of block with name content:
<block type="core/text_list" name="content" as="content" translate="label">
<label>Main Content Area</label>
</block>
You can see the type is core/text_list. Block with this type will render every child under it and it DOES NOT need a template.
As you can see, there is no definition for template="blabla/blibli.phtml".
The type of block that have template is core/block_template. In this type of block, if you want to render its child, you have to "consciously" call echo $this->getChildHtml('mykid').
Do you get it?
That's why your definition is incorrect: <block type="core/text_list" name="main" as="main" translate="label" template="page/html/main.phtml">.
core/text_list doesn't need and doesn't have a template. You can imagine if "content" is a core/block_template: every time you're going to create a child under "content" you have to "consciously" call echo $this->getChildHtml('mykid'). Let's say you have 100 child, you will need to call echo $this->getChildHtml('mykid1'), echo $this->getChildHtml('mykid2'), ..., echo $this->getChildHtml('mykid100').
Then let's see your catalog.xml:
<default>
<!-- Mage_Catalog -->
<block type="core/template" name="top" template="page/html/top.phtml"></block>
<block type="core/template" name="header" template="page/html/header.phtml"></block>
<block type="core/template" name="main" template="page/html/main.phtml">
<block type="core/template" name="left" template="page/html/left.phtml"></block>
<block type="core/template" name="middle" template="page/html/middle.phtml"></block>
<block type="core/template" name="right" template="page/html/right.phtml"></block>
</block>
<reference name="footer_links">
<action method="addLink" translate="label title" module="catalog" ifconfig="catalog/seo/site_map">
<label>Site Map</label>
<url helper="catalog/map/getCategoryUrl" />
<title>Site Map</title>
</action>
</reference>
<block type="catalog/product_price_template" name="catalog_product_price_template" />
</default>
I don't get it what you're going to achieve from this catalog.xml. There are no reference for: <block type="core/template" name="top" template="page/html/top.phtml"></block>, <block type="core/template" name="header" template="page/html/header.phtml"></block>, etc.
If you're going to add some layout (children), you need to "referencing" from an existing one. Let's say you're going to add children under block with name "main" and you're going to put the code in your catalog.xml:
Then your catalog.xml will be like this:
<default>
<reference name="main">
<block type="core/template" name="i" template="my/new/template1.phtml"></block>
<block type="core/template" name="dont" template="my/new/template2.phtml"></block>
<block type="core/template" name="know" template="my/new/template3.phtml"></block>
</reference>
</default>
Now it depends on the definition of block with name "main".
If your block with name "main" is:
<block type="core/text_list" name="main" as="main" translate="label">
...
</block>
then those blocks (blocks with name "i", "dont", "know") will be automatically called (rendered).
If your block with name "main" is:
<block type="core/template" name="main" as="main" translate="label" template="page/html/main.phtml">
...
</block>
Then you need to call this in your page/html/main.phtml:
echo $this->getChildHtml('i');
echo $this->getChildHtml('dont');
echo $this->getChildHtml('know');
That's as far as I can explain as it's pretty much incorrect things in your layout, if you get the point, you can fix it by reading my explanation.
Few tips:
To see which handles loaded, put this code in your controller under $this->loadLayout(); :
$layout = Mage::getSingleton('core/layout');
$updates = $layout->getUpdate();
$handles = $updates->getHandles();
var_dump($handles);
To see the generated xml from load layout, put this code in your controller under $this->loadLayout(); :
$layout = Mage::getSingleton('core/layout');
$updates = $layout->getUpdate();
$xml = $updates->asString();
var_dump($xml);
Maybe you will need echo "<pre>" / wrap using htmlentities / Mage::log for neat looking purpose.
Here are some possible explanations.
Since left, middle, and right are children of 'main' you need to call getChildChildHtml (note the double child).
Since 'main' is a child (nested) inside 3columns it is not considered it's own page type (i.e. 1 column), the better solution seems to edit the 3columns.phtml file to have the blocks that you want.
When calling getChildHtml the parameter passed to it is the name='' attribute in the xml (so for example if the 'right' block needs to be called, then we need to find the name attribute in the xml - in this case it's 'right' and use that for the parameter).
The left, footer etc. blocks are showing because they are already being called in the 3columns.phtml file.
Also double check that the template file to 'main' is in the right location.
I hope these were some helpful pointers
Say I have a given action:
<service category="MyService" name="MyFirstService">
<actions mep="RequestResponse">
<action class="actions.CXFListenerAction" name="CXFServiceListener"/>
<action class="org.jboss.soa.esb.actions.transformation.xslt.XsltAction" name="Transform XML">
<property name="templateFile" value="/stylesheets/transform_response.xslt"/>
<property name="failOnWarning" value="true"/>
</action>
</actions>
I am trying to figure out how to add a property name or parameter that I could then access from within the XSLT. I've tried add additional property names,
<property name="param1" value="Hey!"/>
but I'm not 100% sure if this is correct for adding parameters accessible by the XSLT.
Thanks.
The properties defined for the XsltAction class are properties specific to that action class and are not related to parameters in the template file.
So in short, it's not possible to pass parameters to the xslt from the JBoss ESB action pipeline. However, it would be possible to create a custom action that decorates your ESB message with data you define as a property in your jboss-esb.xml file and insert that before your XsltAction. That may be what you're looking for.
Using cruisecontrol for continuous integration, I have some annoyances with Weblogic Ant tasks and how they think that server debug information are warnings rather than debug, so are shown in my build report emails. The XML output from cruise is similar to:
<cruisecontrol>
<build>
<target name="compile-xxx">
<task name="xxx" />
</target>
<target name="xxx.weblogic">
<task name="wldeploy">
<message priority="warn">Message which isn't really a warning"</message>
</task>
</target>
</build>
</cruisecontrol>
In the cruisecontrol XSL template the current selection for the task list is:
<xsl:variable name="tasklist" select="/cruisecontrol/build//target/task"/>
What I would like is something which selects the tasklist in the same way, but doesn't include any target nodes which have the attribute name="*weblogic" where * is a wildcard. I have tried
<xsl:variable name="tasklist" select="/cruisecontrol/build//target[#name!='*weblogic']/task"/>
but this doesn't seem to have worked. I'm not an expert with XSLT, and just want to get this fixed so I can carry on the real development of the project. Any help is much appreciated.
In the cruisecontrol XSL template the
current selection for the task list
is:
<xsl:variable name="tasklist" select="/cruisecontrol/build//target/task"/>
What I would like is something which
selects the tasklist in the same way,
but doesn't include any target nodes
which have the attribute
name="*weblogic" where * is a wildcard
Use:
/cruisecontrol/build
//target
[not(substring(#name, string-length(#name)-7)
= 'weblogic'
)
]/task