ModX: Display multiple pages on one page -How to implement - modx

I understand I am meant to use Ditto to do this but am unsure where to go from there.
Currently, I have a Template with all my TVs on it along with several pages using the template that are stored under a parent. The Ditto code I am using is:
[!Ditto? &parents=`173`&orderBy=`createdon ASC` &tpl=`showtemp` &display=`100` &total=`100`!]
However, when I view the page I get the error:
&tpl either does not contain any placeholders or is an invalid chunk name, code block, or filename. Please check it.
My chucnk ('showtemp') looks like:
<div class="showmedia">
[*showmedia*]
</div>
<div class="showright">
<h2>[*showname*]</h2>
<h2>[*showtime*]</h2>
</div>
As far as the set up goes I am not sure if I am going about it right.
Do I make a Chunk as if it were a normal template with TVs, then replicate it as a proper template, create the resources and go from there?
If someone could give me a step by step on how to do this correctly I would be very grateful! Thanks

You're getting that error message because your placeholder syntax is incorrect in this context.
[*templateVariable*] is correct for displaying the current resource's TVs, but in a chunk to be used within a snippet loop such as in Ditto you need to format them as placeholders like this: [+templateVariable+]
I would recommend going through each step in the following tutorial, it will help you understand all the MODX fundamentals:
http://codingpad.maryspad.com/2009/03/28/building-a-website-with-modx-for-newbies-part-1-introduction/

Related

Pulling Django variable data using Python

I am currently working on a project to grab live match data for eSports (yeah I'm a nerd, aren't we all?). So I am pulling HTML from a page and checking if my favorite team is playing and if so, go the page and check the scores every few minutes to get updates. The part I am now having trouble with is getting the names of teams and the match ID's. The reason for this is because when I grab the HTML data, inline JS variable names are included instead of their values which is what I need. Here is an example of what I am talking about:
<div class="col-xs-12 schedule-{[{schedule.state}]}" ng-if="schedules.length>0" ng-repeat="schedule in schedules track by schedule._id">
I need a way to grab the value of "schedule.state". Hopefully you guys can help. Also if there is already a similar solution I would be happy to be directed to it! Cheers!
EDIT
I have just realized through a little more researech that the variables are not JS but Django. Given the same problem just on how to get Django variable data instead of JS.

How can I loop SOLines in MailSettings email Body for Acumatica ReportDesigner

Our customers would like us to include fields from the SO Lines in our Sales Order confirmation email, which we are making available to be sent as part of the MailSettings Body for the Sales Order Confirmation report created through ReportDesigner.
Hypothetically, we are able to loop SO Lines like this for an Email Notification by using a foreach loop in the HTML, but I have been unsuccessful with this approach. (The GUI insists on translating my <> symbols into the ascii codes when I try save the directly edited HTML.)
I do not see a way of doing this at all in the MailSettings Body. How can I loop the data here?
EDIT: I found the instructions for linking to the email notification template from within the report so I can use one for both, so if anyone can help solve the mystery of using the within the Email Notification HTML without it automatically replacing the <> characters with ascii that will also solve my problem.
I used html comments to get <foreach> to work correctly inside of a table:
<table>
<!-- <foreach view="Transactions"> -->
<tr><td>Column 1</td><td>Column 2</td></tr>
<!-- </foreach> -->
</table>
I was able to solve this using the Notification Template; my error was in trying to do the loop in the HTML code instead of pasting directly into the Visual page. Functionality is quite limited in terms of being able to add headers for the table outside of the loop, but I got it working by adding another table outside the loop and setting width percentages for both tables. Ugly, but functional.

How do I show all validation errors from the modx register snippet?

How do I show all validation errors from the modx register snippet?
Right now if I want to show all possible errors in my form I have to do something like this:
[[+error.message:notempty=`[[+error.message]]<br>`]]
[[+error.username:notempty=`[[+error.username]]<br>`]]
[[+error.password:notempty=`[[+error.password]]<br>`]]
[[+error.password_confirm:notempty=`[[+error.password_confirm]]<br>`]]
[[+error.email:notempty=`[[+error.email]]<br>`]]
[[+error.salutation:notempty=`[[+error.salutation]]<br>`]]
[[+error.firstname:notempty=`[[+error.firstname]]<br>`]]
[[+error.lastname:notempty=`[[+error.lastname]]<br>`]]
[[+error.institution:notempty=`[[+error.institution]]<br>`]]
[[+error.excountry:notempty=`[[+error.excountry]]<br>`]]
[[+error.province:notempty=`[[+error.province]]<br>`]]
[[+error.provinceother:notempty=`[[+error.provinceother]]<br>`]]
[[+error.excity:notempty=`[[+error.excity]]<br>`]]
[[+error.oncologist-database:notempty=`[[+error.oncologist-database]]<br>`]]
Does anyone know if there is a placeholder that just dumps all errors?
You say little to nothing about how the errors are generated in the snippet.
There are two approcahes to this. You could make the entire error-message into one in the snippet. That way you can simply concatenate them there. It would only require one placeholder in the chunk.
Or you could supply all the error-messages every time the chunk is displayed. The change is that when there are no error-messages, the placeholder is just empty (that way, you don't need to test with notempty). You could also make <br /> a part of the error-string itself. That way you don't need the query at all and you could just list each of the error-messages after each other. It would be "cleaner" in the chunk, but I prefer the first solution.

Dividing long content to subpages

I need to divide long content to sub-pages.
Rule for dividing: Heading1 (H1)
Cms-system: MODX Evolution
As far as i know, there is nothing in modx to use for this kind of problem.
I probably got to do this manually anyway, but i still would like to know if there is a way to do this in MODX Evo / Revo.
Edit:
I need to do this in MODX; sub-pages got to be actual subpages, and original page becomes to container.
Navigation will be done with wayfinder.
Edit2:
All done.. manually. Question still open, though.
This is not possible out of the box and I don't know of any extra that archieves what you want. You would have to write a plugin that acts everytime you save a resource and split up the content, create/delete sibling resources as needed etc. Sounds like a lot of work for what you want to archieve to me.
I suppose you have a look at the MIGX extra. It provides you with a TV with the possibility to store an indefinite amount of distinct TV content sets. Have a look at the documentation and Mark Hamstra's tutorial (with screenshots) to see how it is done. You should define one MIGX entry to consist of a text field for the <h1> and a rich text field for the content of the "subpage".
Afterwards, you can use form customization to hide the original content field and display your MIGX Tv instead.
I think, this is a much easier way to archieve, what you want, and can't think of any way, where you would benefit from actual subpages.
Edit: Sorry, I just recognized that you were asking about Evolution, not Revolution. My solution would work in Revo, but I don't think there's something like MIGX for Evo. Sorry, my mistake.
not 'out of the box' you will have to run your content through a snippet to parse it into separate divs or something that you can run some javascript on to possibly 'tab' the content.
If you need to show the 'subpages' in your navigation, you will probably have to use the gatResources extra to parse your content ~ which will be very expensive on resource usage.
You can (depending on how you're using the tree) just create actual sub resources under the parent resource, using Ditto or Wayfinder to build navigation for it.
If you can't use the tree like that (though from your description I think you can), you could also set up a number of template variables ("content1", "content2", "content3" etc) and show that with a simple snippet or so.

ExpressionEngine show channel content outside of loop

I know this sounds crazy, but I need to show some post information outside of the loop in the expression engine channel module. Is this possible?
You could use EE's SQL Query template tags (if you know, or have access to the database table names and know what to look for in the database):
http://expressionengine.com/user_guide/modules/query/index.html
Basically, you'd output only what you need - it doesn't have to belong to a channel, or anything specific. The one kicker is that you'd have to know the basics of SQL syntax, but if you have a small working knowledge of it, you can do tons of additional things with it.
If you're not keen on SQL, you could simply embed a template within the template that you're working on. Here's a simple example that assumes you're editing the index and meta templates inside of a template group called 'news':
index template contents:
{exp:channel:entries channel="news"}
<div class="entry">
<h1>{title}</h1>
<div class="content">{body}</div>
{embed="news/meta" this_entry_id="{entry_id}"}
</div>
{/exp:channel:entries}
meta template contents:
{exp:channel:entries channel="news" dynamic="no" limit="1" entry_id="{embed:this_entry_id}"}
<div class="meta">
<p>{entry_date}</p>
<p>{author}</p>
</div>
{/exp:channel:entries}
As you can see, the index template is embedding the meta template. Note that we're passing a parameter to the meta template so that it knows which entry ID to print information about. If you're unfamiliar with EE's template embedding feature, you can read more about it in the EE docs. Embedding templates in other templates is a great way to access the {exp:channel:entries} loop multiple times.
There's an add-on called MX Jumper that allows you to "set" a variable from inside your entries loop and then "get" it elsewhere in the template (before or after in the HTML loop doesn't matter because it parses later).
Alternatively, the approach that's all the rage now is to use the add-on Stash to store any and all elements you need to use distinctly as stash variables that you set and then get - similar to the above, except that once you set them, getting them has to happen at a later parsing stage. The beauty of this approach is stash will store the "set" variables for reuse either at a user or site level, and you can determine what the expiry period is - which then results in better performance. When you apply this broadly using the "template partials" mindset, you can store everything with stash, and then call them into a small number of wrapper templates. This makes it possible to use stash to set, for example, your entry title, then get it three separate times in the wrapper template without any additional load - no need for separate loops within your template - one loop to set the variable, and then you can call that variable as needed in your template - it's kind of like creating global variables on the fly.
I would also suggest looking at Stash.

Resources