Set Modx Revolution :nl2br to Output HTML - modx

Is there a way to set Modx Revolution to output HTML <br>s using the :nlb2r output filter rather than XHTML <br />s through a system setting?

Just create custom snippet - http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters+%28Output+Modifiers%29 , as example:
<?php
$mode = !empty($options) ? true : false;
return nl2br($input, $mode);
This filter does not depend on the system settings, he is located in the code modx- https://github.com/modxcms/revolution/blob/develop/core/model/modx/filters/modoutputfilter.class.php#L431 so you need to create custom snippet.

Output filters are hard coded.
You could always:
SomeElement:nl2br:replace=`<br />==<br>`
Not really sure you want to drop the / as HTML5 simply ignores it. But any case, replace will serve you well.
Check out chapter 7 of my book, it has all of the filters and examples on how to chain them.

You should avoid using snippets and filters are much as you can. They increase the parsing-time.
There's a setting for what you ask
Search for tiny.element_format and change it to html.

Related

Add an custom link to the MODX Evolution DLmenu

I'm trying to add a custom link to the menu on MODX Evolution by using DLMenu snippet. Menu displays pages, and after the second point I need to add an anchor link on the main page ... is it possible to somehow implement this at the template level, or apply certain filters?
Thanks for the help,
Alexey
Please share your DLMenu snippet call. If I understand correctly you need to use rowTpl/ rowHereTpl parameters, please use chunk here instead INLINE code and specify the next (snippet If is used):
<li[+classes+]>[+title+]</li>
[[if? &is=`[+iteration+]:=:2` &then=`<li>Home</li>`]]

How to display modules only on search results in Joomla 2.5?

Hello please read the whole question, this isn't just solved by enabling the modules only for the search page:
I have a few modules that are exclusively shown on the search page in Joomla.
I created a hidden menu entry for the search as well in order to tell modules to only show on this page. This works alright, but when I click one of the results and get redirected to the actual result, then the modules, which should only show up on the search page are still shown in the result page.
Any clue how to fix this? Really annoying as I use 3rd party search enhancing modules, and they are showing on the results.
Using standard Joomla, there's no way to target modules to only the search results page and none of the pages that link off the results – but I know you knew that! The hidden menu item is a help, but does not change the menu item of some of the links off that page. It's all to do with the allocation and use of "Itemids" in Joomla.
To be able to target modules more specifically, you need to use a 3rd-party extension. I developed MetaMod (www.metamodpro.com) to cope with exactly this use case. MetaMod is a wrapper module that can then decide just which other module to include in itself (or not). So you assign the MetaMod to the page, then put a snippet of code inside the MetaMod which decides which other module to include.
In this case, I'd use the following in MetaMod:
if ($core_genius->check("pagetype = search, searchresults")) return XXX;
// replace XXX with the module id of the module to include
// ONLY on the search page, or the searchresults page, but
// no other type of page.
Hope that helps,
Stephen
Although MetaMod is great (I've used it myself & Stephen's support is great!) there is another way to do it without using 3rd party extensions.
You could create new module positions in your template above (or below) the module positions you wanted to use and wrap them in an if statement like so:
<?php if(!isset(JRequest::getString('searchword'))) : ?>
<jdoc:include type="modules" name="right-search" style="xhtml" />
<?php endif; ?>

Pagination [+next+] not working on MODx CMS template

I'm having difficulty getting the pagination functionality working with [[Ditto? ... ]] in MODx CMS.
I have the documents displaying in the page, limit is set to 5. The output from my other pagination template placeholders seem to be working but the [+next+] link doesn't load the next set of 5 documents (going in descending date order).
Here's my template code:
[[Ditto?
&parents=`13`
&tpl=`ArticleListChunk`
&display=`5`
&&removeChunk=`Comments`
&paginate=`1`
&extenders=`summary,dateFilter`
&paginateAlwaysShowLinks=`0`
&dateFormat=`%F %D %Y`
]]
<p>Showing <strong>[+start+]</strong> - <strong>[+stop+]</strong> of <strong>[+total+]</strong> Articles</p>
<ul class="clearfix">
<li>[+previous+]</li>
<li>Page <strong>[+currentPage+]</strong> of [+totalPages+]</li>
<li>[+next+]</li>
</ul>
The output I get is:
Showing 1 - 5 of 17 Articles
Page 1 of 4
Next >
as you can see the output is correct, however when I click the 'next' link the resulting URL is .../news.html?start=5 but the content of the page stays the same (i.e. the latest 5 documents are shown!).
This is how the template and functionality was when I was inherited this project from a client, and I have never used MODx CMS before -- can anyone help me please?
I there a way to update the SQL offset with a parameter or something? I've been all through the Wiki pages for Ditto / MODx but can't find what I need or what I should be doing that I'm not!
I would think you need to call ditto uncached [[!Ditto? attribs ]]
That's just a guess.
Also it looks like you are using EVO? check the cache syntax, you might need to put an exclamation mark at the end as well. [[!Ditto? attribs !]]
After plenty of searching I found a post on the MODx forum that pointed me in the right direction.
Turns out that caching was enabled in the page/document's settings (doh!). I disabled this and now it works fine!
However I have not set the no-caching token ('!') in Ditto's parameter string which, including the answer from Sean, my research has suggested is advisable and/or required. I've not worked with MODx before so I can't say for certain, but it seems to work without this for me!
Thanks #SeanKimball as your answer set me down the right path.

How to replacing style of UI element e.g table in Vaadin

I would like to replace the style of custom table.
By using
fooTable.setStyleName("v-tableII");
produces the following result
<div class="v-table v-table-v-tableII v-tableII" ...
(grrr)
It would be important to replace the 'v-table' style because it belongs to another customized table.
Is there any way using different styles for different tables ?
(The help recommends to using addStyle, but the original 'v-table' style is tailored to another custom table )
Thanks for answers in advance.
Cs
This is how vaadin works and you will always have that. You are using the correct option fooTable.setStyleName("v-tableII") but have you remember to add this to your css file? In some cases you might have to set !important on some of the options.

drag and drop in drupal 6 block

I am working on drupal. I am facing problem in block. There is no drag and drop function on the page. When i dissable javascript on my browser it show weight option to set manually, after enable again it is not showing.
can any one suggest about this type of problem. if there is any css related issue please suggest me about this
Usually, when this happens, the <?php print $scripts; ?> call in your theme's page.tpl.php is missing, so that Drupal's JavaScript files aren't being included (it's JavaScript that creates the drag and drop features). Or there is an error/conflict in your JavaScript/jQuery.
Is $scripts being printed in your theme?

Resources