I am trying to create product block on home page where in I copied page.xml to my theme's layout folder and modified it like
<page_two_columns_left translate="label">
<label>All Two-Column Layout Pages (Left Column)</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
<!-- Mark root page block that template is applied -->
<action method="setIsHandle"><applied>1</applied></action>
</reference>
<reference name="content">
<block type="core/template" name="mycategories" output="toHtml" template="sweet/sweet.phtml"/>
</reference>
Here I was expecting one one block in the middle of my Home page and i am getting that but in addition to this i am getting one more block (same as this block sweet.phtml) at the bottom of home page.. below the footer link. Can anyone tell me whats the problem.
You've marked your block as an output block. When the view is rendered via renderView() in the controller action, your block is both a child of a block which echoes its children (content is a core/text_list block), as well as being an output block which will be rendered in its own right.
Remove the output="toHtml" bit and you will have what you need. By the way, you could / should move this change from a custom page.xml and into a local.xml file in your layout - it need only be inside a <page_two_columns_left /> layout update handle.
Related
We have a "Home page" with multiple functionality and one of them is Account command link. Home page is define in the main-flow.xml(see below) and when we will click this link, the new flow should open.
main_page.xhtml file:
<h:commandLink value="Account" target="_blank" action="account"/>
main-flow.xml file:
<view-state id="main_page">
<transition-state on="account" to="newFlowOpen"/>
</view-state>
<view-state id="newFlowOpen" view="/Report/account.xhtml"/>
But when we click this link, than instead of opening new flow like e2s1, its simple opening new execution key with same flow execution like e1s2 which wrong.
Please advise me on this :(
Because you added "newFlowOpen" as a view-state inside the main-flow.xml thus it is a part of main-flow.xml and not an independent stand alone flow.
If you want to create an independent stand alone flow you need to create a new "account-flow.xml" in it's own path. Once you do this the account link on the "Home page" once clicked will leave the existing flow and create a new account-flow.
If holding on/remembering the the main-flow state is important... OPTIONALLY (after doing the above), you can embed the newly created stand alone account flow inside the main-flow as a subflow.
Reasons to create a subflow relationship between parent->child flow:
When you want to pass parameters or POJOs between 2 flows (without embedding the parameters inside the url)
When you want preserve the parent flow's current state(s) and return back to the parent flow once the child flow is completed.
Below is a good example of how to create a subflow:
http://www.springbyexample.org/examples/spring-web-flow-subflow-webapp.html
<!-- You would place the subflow-state below inside main-flow.xml -->
<subflow-state id="accountSubflow" subflow="account">
<input name="id" value="accountId"/> <!-- input to send to subflow-->
<input name="person" value="person" type="foo.bar.entities.Person"/> <!-- input to send to subflow for pojos you have explicitly declare the type-->
<output name="boolSuccess" /> <!-- output returned by the subflow -->
<transition on="save" to="saveForm"/> <!-- "save" = id of the <end-state id="save"> inside the subflow -->
<transition on="cancel" to="cancelForm" /> <!-- "cancel" = id of the <end-state id="cancel"> inside the subflow -->
</subflow-state>
I'm trying to figure out where to edit footer links in magento 1.9 but I couldn't find anything I'll be searching it for almost 3hours but no success. Sorry I'm just a newbie in magento.
I want to edit the links under "QUICK LINKS" "ACCOUNT" I found the link under company and it's in magento backend under static blocks but no success for the two.
Thanks
These links are added in multiple layout files. The easiest way is to do a directory search (in your IDE) for "footer_links" phrase on the "layout/*.xml" files. You'll see that some links are being set in sales.xml, customer.xml or cms.xml. At the bottom of sales.xml for example you should see something like this:
<default>
<reference name="footer_links2">
<block type="sales/guest_links" name="return_link"/>
<action method="addLinkBlock"><blockName>return_link</blockName></action>
</reference>
</default>
This tells Magento to add the "Orders and Returns" link to the "Account" block in the footer. If you change the footer_links2 to footer_links, this link will end up in the "Quick Links" block. I think once you find this, you'll figure out the rest.
The other links and title are set via layout system:
page.xml:
<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
<block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">
<label>Page Footer</label>
<action method="setElementClass"><value>bottom-container</value></action>
</block>
<block type="page/switch" name="store_switcher" as="store_switcher" after="*" template="page/switch/stores.phtml"/>
<block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml">
<action method="setTitle"><title>Quick Links</title></action>
</block>
<block type="page/template_links" name="footer_links2" as="footer_links2" template="page/template/links.phtml">
<action method="setTitle"><title>Account</title></action>
</block>
<!-- This static block can be created and populated in admin. The footer_links cms block can be used as a starting point. -->
<!--<block type="cms/block" name="footer_social_links">
<action method="setBlockId"><block_id>footer_social_links</block_id></action>
</block>-->
</block>
Then in catalog.xml links are added:
<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>
The links are available on Admin menu -> CMC -> static block
Here available Footer Links, and repalace/modify the required links.
on CMS/pages you can find an option to edit the footer whatever you want.
Bro, You can create your a custom static block and add it to your footer, just replace the old one. Hope that helps..cheers..
Hi it can also simple.
Paste in your style.css from your themes.
ul.links { display:none}
or on another class from the first block. And make new links in your first block in the admin by statisch block.
I need to refresh page in include tag, but this is load dynamically using forEach property, this is a fragment of my code:
<button onClick="... refresh include page ..."/>
<tabbox id="tb" orient="vertical" >
<tabs>
<tab forEach="${vm.columnList}" label="${each}" hflex="true"/>
</tabs>
<tabpanels>
<tabpanel forEach="${vm.columnList}" >
<include height="90%" rc="/Campaigns.zul" rca="${each}" date="${vm.date}" />
</tabpanel>
</tabpanels>
</tabbox>
I want that when the button is pressed, the page that is in the include will reload, not whole page. Try using an id to use invalidate function, but using the forEach property to load the page gave an error with repeated id.
The page is loaded using forEach because depending of the parameter that is passed the content is different and different tabs are generated.
In the onClick of the button try this
<button onClick="tb.getSelectedPanel().getFirstChild().invalidate()" />
i have a page with authentification which forword to my template page where there is menus.
<navigation-rule>
<from-view-id>pages/login.xhtml</from-view-id>
<navigation-case>
<from-outcome>userOK</from-outcome>
<to-view-id>pages/template.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>userNOK</from-outcome>
<to-view-id>pages/login.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
my page template.xhtml
<h:form>
<p:menu type="plain" style="width:200;box-shadow: 6px 6px 6px black;top:-18;left:-40" >
<p:submenu label="Dossier" id ="Dossier" >
<p:menuitem update=":contentform,:messages" value="Nouveau Dossier" action="#{choix.setPage('ajoutDossier')}"
....
....
</h:form>
<h:form id="contentform" >
<h:panelGroup rendered="#{choix.page == 'ajoutDossier'}">
<ui:include src="Dossier/ajoutDossier.xhtml" />
</h:panelGroup>
....
....
</h:form>
the problem is that action isn't invoked at the first click i have to click 2 time , and before i click many time and action isn't invoked, and sometimes juste p:submenu which are in the last position work
also when it was no forward just the page template.xhtml it's work !
You are not taking advantage of JSF templates. Instead of using a template and several template clients you have everything in one page; and render stuff conditionally. Look this tutorial or any other tutorial about jsf tempaltes.
Normally you would have a template, which has all the layout and content common to all pages; and uses the tag <ui:insert name="title" >Default content</ui:insert> as many times as you need (with different names). Then you create a template client, defining the template using
<ui:composition template="./../resources/templates/templateFile.xhtml">
And then use the tag <ui:define name="nav2"> to set the content to include in the template.
Besides that, about the problem with navigation in your code: when you do a navigation you don't update content, because after a navigation the page is completely loaded (no ajax). So first of all you have to remove your update attribute; and also you have to set the "ajax" attribute of p:menuitem to false; because by default it's true. otherwise navigation will not take place.
the redirect attribute in the navigation rule is not required if you did things ok. It can work perfectly fine with a forward. The only problem with forward is that the browser URL will not change, because browser is not notified of the navigation.
i found the solution i have to add <redirect /> after the <to-view-id> of page which have the problem, because i read that JSF uses internal FORWARD instead of REDIRECT to navigate to the success page and this why the URL will not get changed but i don't really undestand why ??
here is the code who work :
<navigation-rule>
<from-view-id>pages/login.xhtml</from-view-id>
<navigation-case>
<from-outcome>userOK</from-outcome>
<to-view-id>pages/template.xhtml</to-view-id>
<redirect />
</navigation-case>
<navigation-case>
<from-outcome>userNOK</from-outcome>
<to-view-id>pages/login.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
also to not loose css of redirect page i have to add this
<link rel="stylesheet" href="#{request.contextPath}/css/style.css" />
I’ve created a menu in page.xml and it looks like this:
<reference name="primary.menu">
<action method="addLink" translate="label title">
<label>Test</label>
<url>test.html</url>
<title>Test</title>
<prepare>1</prepare>
<urlParams/>
<position>10</position>
<liParams>dark-gray</liParams>
<aParams></aParams>
<beforeText></beforeText>
<afterText></afterText>
</action>
...................
The class used for the primary.menu block is extending the Mage_Page_Block_Template_Links class from Magento’s core.
The problem is, that when I click this link it goes to ‘www.mydomain.com/test.html/’ which is not working. My question is what should I do in order to stop the last ‘/’ from showing in the url?
I think that <prepare>1</prepare> is building your URL query (in the absence of a dedicated helper to supply the URL) and as a result is prefixing your URL with the domain (which is what you want), but it is also appending a trailing slash (which is what you don't want)
Either create a helper to supply the "proper" URL.
If the page is a Magento CMS page, use that helper (preferred)
Use <prepare/> and <url>/test.html</url> (hack alert!)
To use a Magento CMS helper to add a link
<action method="addLink" translate="label title before_text" module="cms">
<label>Test</label>
<url helper="cms/page/getPageUrl">
<page_id>1</page_id>
</url>
<title>Test</title>
<prepare/>
<urlParams/>
<position>10</position>
<li/>
<a/>
<before_text/>
<after_text/>
</action>