What is the purpose of path in module result?
https://doc.ez.no/eZ-Publish/Technical-manual/3.8/Templates/The-pagelayout/Variables-in-pagelayout
Is it for getting a different path in page layout than the actual path?
The purpose of the path property in module result is, in most of the cases, to generate breadcrumbs. It contains an array of breadcrumb node needed to build the HTML links which are part of your breadcrumb.
Each item of this array is also an array containing at least the following key :
text : used for the innerHTML part of the <a> tag
url : used for the href attribute of the <a> tag
url might be false and it's often the case when you are on the last item which basically means that you will display the name of that breadcrumb node but you don't want to create a link for it, since you are already on the related page...
For built-in modules, eZ Publish always provides the $module_result.path variable on the pagelayout. In addition to that, when you are viewing a content, it will also provide the url_alias (/Folder/Article for instance) which is better than the 'system url' of the content (/content/view/full/123 for instance).
If you want to provide such information for your custom modules, you just need to return it at the end of your controller (in extension/myextension/modules/myviewcontroller.php for instance) :
<?php
// ....
$Result['path'] = array(
array('text'=>'My custom module','url'=>'/mymodule/myview'),
array('text'=>'My view','url'=>false),
);
Related
Is it possible to get list of URL's / links available in a website by providing base URL as an input. Using nightwatch, if i pass base URL it should give all hyperlinks, child pages links etc. using Nightwatch. If its possible, how we can achieve it.
Not sure Nightwatch is the right choice for what you are trying to achieve. Maybe you can let us know what you want to do with the list of urls you fetch from the page?
You can set the URL via page object configuration and when the page loads (page.navigate()) you can return all link elements. Something like:
browser
.elements("css selector", "a", result => {
// Do something with 'result' that will contain all the elements matching "a"
})
But I recommend you read more about Nightwatch to determine if that is the right tool for your needs.
More about Nightwatch: http://nightwatchjs.org/gettingstarted
More about Page objects: https://martinfowler.com/bliki/PageObject.html
I'm working with Joomla v3 and have this problem:
I have 2 modules (for example module_1 and module_2) in one position. Module_1 is above module_2 in all pages, but in one page it should be in reverse.
I know I can duplicate modules and add they to new position but I just want only one module instance. So if I change this module it will be change across website.
So how to have only one module instance and apply different order in different pages?
Thanks
You can create 2 new HTML modules and use {loadmodule module} as code and assign it on the desired position (inverted).
But in most of the cases does not work. In your case I will assign your modules position to two new positions (i.e.: assign theme to module1_position and module2_position). Then create four new html module using {loadposition position_created} and assign them on the desired real position. The four module are just for positioning and the original module are for configuration.
At the end you will have:
module_1 -> your module in position module1_position.
module_2 -> your module in position module2_position.
new_module1_a -> HTML module with the code {loadposition module_1} assigned to position a in all pages minus the one you want different.
new_module2_b -> HTML module with the code {loadposition module_2} assigned to position b in all pages minus the one you want different.
new_module1_b -> HTML module with the code {loadposition module_1} assigned to position b in the single page you want inverted.
new_module2_a -> HTML module with the code {loadposition module_2} assigned to position a in the single page you want inverted.
I hope I made myself clear ;)
EDIT: (After your comment)
In this case you can just create 2 HTML module:
new_module1 with the code {loadposition module_1}{loadposition
module_2} assigned to all pages minus the one you want different
new_module2 with the code {loadposition module_2}{loadposition
module_1} in the page you want different.
You can change your template so that you have two different positions (A and B) and assign one module to each. You can then add a parameter so that for a given style the positions go either B A or A B. Then assign the appropriate style to the appropriate page for the order you want.
Alternatively, depending on your containers, it is possible you could use css to control the positioning.
OK, so I figured it out. I'm using Joomla version 3.4.
Create module globally - in my case create custom HTML module and
don't assign it to any position/sidebar and show this module on
every page (pages can be selected by your own but at least all pages
that you want module to show up must be selected). Very important is
to check 'Prepare content' ('yes' or it must be green) under Options
tab.
Create new custom HTML module that you want to show in position
one - so select every page that you want and of course the position
you want. After creating you can of course order the module as you
want. In the content you need to add this code: {loadmodule custom,Name of your global module}. Very important thing is to check 'Prepare content' under
Options tab again.
Create another custom HTML module that you want to
show in another position - do the same as in the point 2.
Now you can assign both modules to pages you want, positions you want and order it as you want. Of course if you need to use this module for another position for other pages you can create third module and do the same. Everything you need to change is the global custom HTML module. That's all.
Hope it was helpful for anyone.
I've created a custom hook, so that I can include my custom module in any .tpl file by a single line: {hook h='calcSubstrate'}.
However, I can't use it in CMS page, at least not by using the admin panel - including smarty code in a CMS page won't render, the code would appear just as it is, as a text: {hook h='calcSubstrate'}.
Alternatively, if that would be easier/faster - how can I choose on which pages my module would appear?
The editor for CMS page won't recognize any Smarty code. To include hooks in chosen articles/pages, I can think of two options:
Include the hook in the template (cms.tpl), and check for the id of the current page to conditionally display the module. The list of the page ids can be made as the module's configuration.
Build a module to add functionality similar to Wordpress's shortcode to the CMS content. I do this with module instead of overriding the CmsController class, hence I have to display the content with {$cms->content|module}. You can look at the simplified code here for inspiration: https://gist.github.com/tungd/cef0ca1ac1063c1ee90b. Of course you can make it more generic like Wordpress, by having only one Smarty modifier do_shortcode that does everything (just like Wordpress's do_shortcode function).
Last time I did this it was because my client want to put slideshows in some CMS pages, and I chose the second approach because it gives a lot of flexibility about when the module is displayed and where it is displayed between the content. For something else, for example Contact Form, or Map, this would be overkill and the first approach is better.
I'm trying to use markup tags to link to info pages within the "description" attribute of a product. However, it's not giving me a clean URL path when the description is printed to the page.
Trying:
Contact Us
does not give the expected url. I've confirmed i'm doing this outside of WYSIWYG mode too.
When the text is rendered is returned to the browser as this html:
Contact Us
A resulting click on the link then ends up as:
http://example.com/prod-category/my-product/%7B%7Bstore%20url=
From what I can tell the markup tags aren't designed to be used in this way. Is it possible to extend it so it could work? Otherwise I guess I need to include the actual URL in the description?
Thanks for suggestions.
You can´t use the double-curly syntax because the attributes value is not being processed by magento´s template filter, which does the magic. You can use them e.g. in CMS or email Templates out of the box.
I'm trying to display an XML feed in a custom Joomla 2.5 component's view/layout, but the XML is rendered as a regular layout inside the site's HTML template. How can I display the XML without any template HTML code?
(The trick to include tmpl=component in the URL from this related question doesn't help, there's still some HTML output from the template that ruins the XML.)
I would prefer a solution that only involves code changes in my custom component, like in Symfony when you call the method setLayout(false).
The only solution I have found is to create a file in the current template folder, e.g. "xml.php", and put only this in the file:
<?php
$document = JFactory::getDocument();
$document->setMimeEncoding('text/xml');
echo '<?xml version="1.0" encoding="UTF-8" ?>';
?>
<jdoc:include type="component" />
Then I can append tmpl=xml to the URL.
[edit]
My bad, I made an assumption and you know what that gets you.
Joomla! 1.6->2.5 you can create an alternate output format for an existing view by:
calling the view with a format parameter attached e.g. &format=json
creating a matching view class file e.g. view.json.php that can sit alongside the standard view.html.php file for you view.
The view.yourformat.php file can use your existing controllers and template files in the normal fashion.
Don't forget to add either &tmpl=component or &tmpl=raw to your query string so modules etc don't load as well.
tmpl=raw won't load the html body surrounds or template, only the main component.
[/edit]
From Joomla! 1.6 onward (including 2.5) there is built in support for controller formats ie. you create a controller for the output format you want.
Normally a controller would be named for each view:
/components/mycomp/controllers/myview.php
A XML version of the controller would be name:
/components/mycomp/controllers/myview.xml.php
A JSON version would be:
/components/mycomp/controllers/myview.json.php
To call a particular format version of a controller you simply add &format=theformatyouwant to the URL parameters, so in your case &format=xml
This is discussed in this document from 1.6 days - I used it as a basis for several of our components that have JSON and ics requirements.
This issue drove me crazy a couple of times.
After much frustration, the simplest solution is the one suggested by cppl. In your query
string put the following variables:
format=yourcustomformat
view=viewname
Let say you want json output from a view called json.
Create a veiw folder with the name of your view
json
And a file inside that folder called
view.json.php
Then in your url string you include the following url parameters seperated by the & symbol:
index.php?option=com_mycomponent&format=json&view=json
cppl is correct that this loads a non-html view. However you don't have to put the tmpl parameter in at least in 2.5. If the view name is not view.html.php then 2.5 seems to not include the assigned site template in the response. I think because the view is not veiw.html.php it assumes raw output and does not include the template. I tested this with both an ajax call and a direct url call to the view and in both cases all I got back was the component output. Yeah!
If someone knows where this issue is well documented by the Joomla folks please post!