I am following the Alan Storm Magento tutorials
http://alanstorm.com/layouts_blocks_and_templates
In this tutorial he suggests creating an html template file at this location
app/design/frontend/base/default/template/simple_page.phtml
However templates look like they are grouped into additional directories by module name. Is this the current standard?
I am using Magento 1.6.2. I am not sure what version the tutorial is tested for.
* additional information *
I created a file called "local.xml" at this location
app/design/frontend/base/default/layout/local.xml
that contains:
<layout version="0.1.0">
<default>
<reference name="root">
<block type="page/html" name="root" output="toHtml" template="simple_page.phtml" />
</reference>
</default>
</layout>
then file "simple_page.phtml" in directory:
app/design/frontend/base/default/template/
that contains:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<p>hello world</p>
</body>
</html>
After clearing cache, I get "white screen of death" on home page, however helloworld page works.
If I erase local.xml, front page comes back.
Here is a short Turorial but the main concept is that you make your own theme/template and overwrite the default templates.
So you can create under System -> configuration -> Design under the point Theme you change the default to your own theme name like "my_theme".
Rest you can see in the tutorial. You can put a folder with your theme name to
app\code\frontend\default\my_theme
Then you can copy the template from default with the same folder structure to your theme and magento take the template from your theme folder instead the default template.
Keep reading the tutorial...
http://alanstorm.com/layouts_blocks_and_templates
"If you go to any other page in your Magento site, you’ll notice
they’re either blank white, or have the same red background that your
hello world page does. Let’s change your local.xml file so it only
applies to the hello world page. We’ll do this by changing default to
use the full action name handle (helloworldindexindex)."
<layout version="0.1.0">
<helloworld_index_index>
<reference name="root">
<block type="page/html" name="root" output="toHtml" template="simple_page.phtml" />
</reference>
</helloworld_index_index>
</layout>
Related
I'm creating a dialogflow agent integrated with Google Assistant.
What I'd like to do is to open an app (my app) when a proper intent is matched. I've seen that actions like Youtube, Spotify etc. are able to do that, for example I can tell the Youtube action "search for cats video" and the Youtube app will open with a list of cats videos.
I tried to use the DeepLink class but I then noticed it's deprecated.
DeepLink class
Is there any way you can suggest me to do this?
Thanks in advance
I think you are looking for App Actions. Here are the steps you need to follow:
Find the right built-in intent. actions.intent.OPEN_APP_FEATURE should be the right one for you.
Create and update actions.xml. It should look like
<?xml version="1.0" encoding="UTF-8"?>
<!-- This is a sample actions.xml -->
<actions>
<action intentName="actions.intent.OPEN_APP_FEATURE">
<!-- Use url from inventory match for deep link fulfillment -->
<fulfillment urlTemplate="{#url}" />
<!-- Define parameters with inventories here -->
<parameter name="feature">
<entity-set-reference entitySetId="featureParamEntitySet" />
</parameter>
</action>
<entity-set entitySetId="featureParamEntitySet">
<!-- Provide a URL per entity -->
<entity url="myapp://deeplink/one" name="featureParam_one" alternateName="#array/featureParam_one_synonyms" />
<entity url="myapp://deeplink/two" name="featureParam_two" alternateName="#array/featureParam_two_synonyms" />
</entity-set>
</actions>
i have create a new page in alfresco share but the page cannot be displayed without login! how can i make this page enabled without login.
my file in "/alfresco/templates/blog/demo/custom-viewer.ftl".
and this file contains "custom-viewer.ftl":
<#include "include/alfresco-template.ftl" />
<#templateHeader>
<#script type="text/javascript" src="${url.context}/res/modules/documentlibrary/doclib-actions.js" group="document-details"/>
<#link rel="stylesheet" type="text/css" href="${url.context}/res/components/document- details/document-details-panel.css" group="document-details"/>
<#templateHtmlEditorAssets />
</#>
<#templateBody>
<#region id="web-preview" scope="template"/>
</#>
<#templateFooter>
</#>
and the file in "/alfresco/site-data/pages/custom-viewer.xml".
and this file contains "custom-viewer.xml":
<?xml version='1.0' encoding='UTF-8'?>
<page>
<title>Custom Viewer</title>
<template-instance>custom-viewer</template-instance>
<authentication>none</authentication>
</page>
the page is work correctly but i need it to work without login? any help please?!!
The thing is probably not your page which needs login but the components it's including.
I'm seeing component regioun web-preview, if this defaults to the default web-preview: site-webscripts\org\alfresco\components\preview\web-preview.get.desc.xml
Then this components needs authentication, there is no <authentication> tag, so it defaults to user.
If you delete that <#region....> tag, you'll see the page.
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
I am pursuing the task of adding my custom tabs inside my Confluence set up. I have chosen the 'Advanced' region as the favourable spot to realize this.
So i click on the Space name. Then I goto 'Browse>>Advanced' and see This http://imageshack.us/f/405/advanc.png . The "Freeway Project Creation " tab we see in this image was custom added by me.
I wrote this class
package com.atlassian.myorg;
import com.atlassian.confluence.core.ConfluenceActionSupport;
import com.atlassian.confluence.pages.AbstractPage;
import com.atlassian.confluence.pages.actions.PageAware;
import com.opensymphony.xwork.Action;
/**
* The simplest action possible
*/
public class ExampleAction extends ConfluenceActionSupport
{
#Override
public String execute() throws Exception
{
return Action.SUCCESS;
}
}
used this atlassian-plugin.xml
<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
</plugin-info>
<resource type="i18n" name="i18n" location="message" />
<web-item name="add-fpc-label-action-web-ui" key="add-fpc-label-action-web-ui" section="system.space" weight="150">
<description key="item.add-fpc-label-action-web-ui.link.desc">Allows the Create Freeway Project functionality.</description>
<label key="Freeway Project Creation"/>
<link linkId="add-fpc-label-action">/plugins/examples/hello.action?key=$helper.space.key</link>
</web-item>
<xwork name="My Example Action" key="example-action">
<description>Shows a simple "Hello, World!" Action</description>
<package name="examples" extends="default" namespace="/plugins/examples">
<default-interceptor-ref name="validatingStack" />
<action name="hello" class="com.atlassian.myorg.ExampleAction">
<result name="success" type="velocity">/templates/example/hello.vm</result>
</action>
</package>
</xwork>
</atlassian-plugin>
The below seen is the VM
<html>
<head>
<title>This is my Example action!</title>
<meta name="decorator" content="atl.general" />
</head>
<body>
<strong>Hello, Confluence World!</strong>
</body>
</html>
As a result when i click on this tab named "Freeway Project Creation " i see this page http://imageshack.us/f/846/imageprf.png/
Well this was good enough. But i wanted to have this page seen in the 'body area' besides the sidebar. Like for example if we click on the "Space Admin" tab and we click on 'Edit Space Label' from the side bar; we see the resulting page in the 'body area' marked http://imageshack.us/f/809/bodyarea.png/.
Would like to have your sugessions as to how that can be achieved?
Thanks
A
Please try this
##requireResource("confluence.web.resources:space-admin")
<html>
<head>
<title>This is my Example action!</title>
<meta name="decorator" content="atl.general" />
</head>
<content tag="key">$action.space.key</content>
<body>
#applyDecorator("root")
#decoratorParam("helper" $action.helper)
#decoratorParam("context" "space-administration")
#decoratorParam("mode" "view-space-administration")
#applyDecorator ("root")
#decoratorParam ("context" "spaceadminpanel")
#decoratorParam ("selection" "add-fpc-label-action-web-ui")
#decoratorParam ("title" $action.getText("action.name"))
#decoratorParam ("selectedTab" "admin")
#decoratorParam("helper" $action.helper)
<strong>Hello, Confluence World!</strong>
#end
#end
</body>
</html>
In our web application we have lots of JS and CSS files.
We need to append a version number to these references every time we deploy the code. This is to make sure that users always get the latest deployed version of the file, and the file will not be served from browser's cache. We plan to do this using our build script.
We need to append a parameter to the file reference like <script type="text/javascript src=./abc/test.js?v=1231/>.
We need to do this for all CSS and JS files.
Can someone please suggest the best appraoch to do this?
We are planning to do this using regular expression. We will append a random number to the file name.
Can you please help me how I can find out all the CSS and JS reference in my HTML page?
Do you need to find all the CSS and javascript references in your HTML files? It would be simpler to use a replaceable token in these files and then run a task in ant to do the replacements. Ant only needs to find the tokens.
You could do this with the ReplaceRegExp task (to make the substitution in place), or you could do a Copy or Move with a FilterSet (to make the substitution in copies of the target files).
Here is an example using ReplaceRegExp:
<project default="test">
<property name="build.version" value="1231"/>
<target name="test">
<replaceregexp match="\#BUILD_VERSION\#" replace="${build.version}">
<fileset dir="test">
<include name="*.html"/>
</fileset>
</replaceregexp>
</target>
</project>
Here is a sample file before running the build:
<html>
<head>
<script type="text/javascript" src="./abc/test.js?v=#BUILD_VERSION#"/>
</head>
</html>
And here it is after:
<html>
<head>
<script type="text/javascript" src="./abc/test.js?v=1231"/>
</head>
</html>