Provide new references for static blocks in Magento layout - templates

I want to display a carousel and two banners at the top of each page content of my site.
I’ve created a custom reference starting from the footer block in page.xml.
So this is what it looks like:
<block type="page/html" name="topcontent" as="topcontent" template="page/html/topcontent.phtml">
<block type="page/html_wrapper" name="topcontent.container" as="topcontentContainer" translate="label">
<label>Page Top Content</label>
<action method="setElementClass"><value>topcontent-container</value></action>
</block>
<block type="core/template" name="topcontent.book.carousel" as="topcontentCarousel" template="callouts/book-carousel.phtml"/>
<block type="core/text_list" name="topcontent.left" as="topcontentLeft" />
<block type="core/text_list" name="topcontent.right" as="topcontentRight" />
</block>
Then I created a topcontent.phtml file where I put
<div class="topcontent-container">
<div class="topcontent">
<?php echo $this->getChildHtml('topcontentContainer') ?>
<?php echo $this->getChildHtml('topcontentCarousel') ?>
<?php echo $this->getChildHtml('topcontentLeft') ?>
<?php echo $this->getChildHtml('topcontentRight') ?>
</div>
</div>
I have my carousel displayed correctly, but when I try to put a block in topcontentLeft or topcontentRight, it is not displayed ad all.
I think I’m doing something wrong with the block type parameter, but I can’t figure out what: can someone provide me some help?
Thanks.

Depends on what you need to display in banner. If it's just some text you could use text block:
<block type="core/text" name="topcontent.right" as="topcontentRight">
<action method="addText"><text>Test text</text></action>
</block>
If you need placeholder block to show some CMS static block content, then you're right, cote/text_list is appropriate type for such block. It takes all it's nested blocks and render them one by one. So next you need to do is to put cms/block placeholder, its content could be added later from backend. All together it may looks like:
<block type="core/text_list" name="topcontent.right" as="topcontentRight">
<block type="cms/block" name="topcontent.right.cms" as="topcontentRightCms">
<action method="setBlockId"><block_id>topcontent_right_static</block_id></action>
</block>
</block>
Now you could create new static bloc in admin backend with 'topcontent_right_static' id and it'll be rendered in place where you output it.

I think the problem is in the #type attribute for topcontentLeft and topcontentRight
type="core/text_list" need to be changed to type="core/template"

Related

Load image in CustomListIem cell

I´m trying to populate a CustomListItem cell in SAPUI5 with an image from my project´s source folder, but it is not showing on the cell. It is placed directly in the WebContent folder: App/WebContent/TEST.jpg, and the view code:
<Page title="View" showNavButton="true" navButtonPress="onBack">
<content>
<CustomListItem type="Inactive">
<Image src="{TEST.jpg}" class="content" />
<Button text="Press me!" class="content" />
</CustomListItem>
</content>
</Page>
the button is being shown in the first cell of the list (where the image should be), but not the image, does anyone know how can I fix it?
You need to change the url path in the src property. If you enclose it in the brackets ({}), SAPUI5 expects a property binding path which in you case is invalid.
So replace this,
<Image src="{TEST.jpg}"
with
<Image src="TEST.jpg"

Opencart - Test VQmod XML file - What's wrong here?

just getting used to using VQMod.
What is wrong here? It isn't updating on the front-end.
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id>VQMOD CORE FOR OPENCART - DO NOT REMOVE</id>
<version>1.4.x and above</version>
<vqmver required="true">2.5.0</vqmver>
<author>vqmod.com</author>
<file name="admin/view/template/common/footer.tpl">
<operation info="Example of the vQmod">
<search position="replace"><![CDATA[
<?php echo $affiliate; ?>
]]></search>
<add><![CDATA[
I am replaced content!!
]]></add>
</operation>
</file>
</modification>
Cheers!
Actually you are trying to change the "backend" but with no luck!
I think you should read:
vQmod: https://github.com/vqmod/vqmod/wiki
Examples: https://github.com/vqmod/vqmod/wiki/Examples
Scripting: https://github.com/vqmod/vqmod/wiki/Scripting
The problem is the following, in this file footer.tpl
admin/view/template/common/footer.tpl
This is the content:
</div>
<div id="footer"><?php echo $text_footer; ?></div>
</body></html>
And your script want to find this "echo $affiliate;" but this content don't exist in this file.
I don't know what file you want to use, but this file don't has this content
admin/view/template/common/footer.tpl
Regards,
Miguel

titanuum mobile xmlmarkup events

moving from actionscript (flex) to titanium and I'm experimenting with the xml markup. What I have is a template that I picked up from the doc
<ItemTemplate name="template">
<ImageView left="0" bindId="pic" id="icon" />
<Label bindId="info" id="title"/>
</ItemTemplate>
</Templates>
my question is if someone clicks on the pic or a listitem itself, how does one handle the events. through xml markup? Then how do you reference any of the control wrap in the template?
I have tried
<ImageView left="0" bindId="pic" id="icon" onclick="doClick()" />
function doClick(e) {
alert($.info.text);
}
This just produces a error and I still would not know what pic was clicked.
any help would be great..
thanks Mike
Have you checked out the Alloy Quick Start? I think many of your questions can be answered there.
Anyway, for ListViews, you cant add an event listener to an item in the template, its just a template not an actual thing on the screen (yet), refer here, and look at the alloy section.
Instead you need the itemclick event listener on the ListView itself. Check , below for a simple example of what the XML markup looks like.
<ListView id="listView" defaultItemTemplate="template" onitemclick="yourEvent" >
<!-- The Templates tag sets the ListView's templates property -->
<Templates>
<!-- Define your item templates within the Templates tags or use the
Require tag to include a view that only contains an ItemTemplate -->
<ItemTemplate name="template">
<ImageView bindId="pic" id="icon" />
<Label bindId="info" id="title" />
<Label bindId="es_info" id="subtitle" />
</ItemTemplate>
</Templates>
<ListSection headerTitle="Fruit / Frutas">
<!-- You can specify any ListItem or ListDataItem properties in ListItem -->
<!-- Specify data to bind to the item template with inline attributes
defined as <bindId>:<Ti.UI.Component.property> -->
<ListItem info:text="Apple" es_info:text="Manzana" pic:image="/apple.png" />
<ListItem info:text="Banana" es_info:text="Banana" pic:image="/banana.png" />
</ListSection>
</ListView>
Also, you need any JavaScript to be in the controller files, not in the XML markup files. *.js has javascript that is behind the view, which is *.xml.

jsf header navigation menu - template

I have template like here:
http://www.mkyong.com/jsf2/jsf-2-templating-with-facelets-example/
i add menu navigation:
<h:form id="form">
<div id="page">
<div id="header">
<ui:insert name="header" >
<ui:include src="/pages/template/header.xhtml" />
</ui:insert>
<f:ajax render="ContentLoader">
<h:commandLink actionListener="#{contentPage.setPage('/pages/first.xhtml')}" value="About Us" />
<h:commandLink actionListener="#{contentPage.setPage('/pages/login.xhtml')}" value="Contact Us" />
</f:ajax>
</div>
<h:panelGroup id="ContentLoader" >
<div id="content">
<ui:insert name="content" >
<ui:include src="#{contentPage.page}" />
</ui:insert>
</div>
</h:panelGroup>
</div>
</h:form>
links are working fine, but i have problem with redirect content by useing <h:commandButton action="link"> which is in content
how can i fix this problem?
maybe it's something wrong with my layout?
or how to correctly redirect from content to another content, useing buttons which are in contents?
As to your concrete problem, it's likely caused by the combination <ui:include src="#{...}"> and a view scoped bean. This construct works only if you upgrade to at least Mojarra 2.1.18. Otherwise, the view scoped bean will fail to restore and be newly recreated and therefore the default value of #{contentPage.page} will be considered when any form actions inside the page are to be decoded. Upgrading to at least Mojarra 2.1.18 should fix your problem. You can get it at http://javaserverfaces.java.net. It's currently already at 2.1.25.
As to your concrete functional requirement, using command links/buttons for plain page-to-page navigation is a poor practice. You should be using output links/buttons for this.
<h:button value="navigate" outcome="link" />
or
<h:link value="navigate" outcome="link" />

Joomla ACL custom actions

I'm creating a custom (1.6) component wherein users can book a camp site. Users will be required to log in if they want to use funds/credits that they already have stored. Only certain groups can use these funds/credits.
I have created an access.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<access component="com_propbooker">
<section name="booking">
<action name="booking.create" title="Book Site" description="Allows users of this group to book sites." />
</section>
</access>
and my config.xml file:
<config>
<fieldset name="API Configuration" label="API Configuration">
<field name="google_api_key" label="Google API Key" type="text" size="50" default="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
</fieldset>
<fieldset name="Booking Permissions" label="Booking Permissions" description="Set Groups that can book sites">
<field name="booking_permission" label="Booking Permission" type="rules" class="inputbox" validate="rules" filter="rules" component="com_propbooker" section="booking" />
</fieldset>
</config>
It all shows up fine when I click the options button, but no changes are ever saved. It always flips back to "Inherited" when i click the "Save" button.
Thanks in advance for any insight.
Try using permissions as the fieldset name and rules as the fieldname in your config.xml.
Like this:
<fieldset name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC" >
<field name="rules"
type="rules"
label="JCONFIG_PERMISSIONS_LABEL"
class="inputbox"
validate="rules"
filter="rules"
component="com_propbooker"
section="booking"
/>
</fieldset>
I would also consider using the section name component as it is the default naming. But your needs may be different.