MODx Wayfinder &level=2 exclude ALL but one - modx

I am trying to write a Wayfinder call level 2 that excludes ALL level 2 docs except one level 2 doc (id=39) (so ALL level 1 docs have to be included). How to achieve that?
[[Wayfinder? &startId=`0` &level=`2` excludeDocs=`3,4,5,6,7,8,9` &outerTpl=`menu`]]
The best I could come up with was to list ALL level 2 docs to exclude, not very neat solution. Also tried using PHx but no success.

Only other way I can see would be to have 2 wayfinder calls, one for top level, one for level 2 and use &includeDocs.
Stucture:
-Resource 1
-Resource 2
-Resource 3
-Resource 4
-Resource 5
-Resource 39 (just inc this resource)
-Resource 7
Level 1 One:
[[Wayfinder?
&startId=`0`
&level=`1`
&outerTpl=`menu`]]
Level Two:
[[Wayfinder?
&startId=`2,5`
&level=`1`
&includeDocs=`39`
&outerTpl=`menu`]]

You could include the single level two resource by giving it a specific template and using the 'where' parameter:
[[Wayfinder? &startId=`0` &level=`2` &where=`{"template:IN":[1,2,3]}` &outerTpl=`menu`]]
You would have to add the template id's for the other resources you want included as well.

To exclude the contents of an entire directory from Wayfinder (or getResources) and stay within the natural boundaries of the intent of automatic menu building, consider using a Weblink resource as a proxy for the parent directory whose children you wish to hide, and then simply hide the actual parent directory from menus.
Mark the Parent Directory whose children you wish to hide as
"Hide from Menus"
Create a Weblink Resource back to that Parent directory and have it display as a proxy back to that directory
The actual parent directory remains nice and neat. Any children within it (even new ones) are still organized and neat, and the "proxy" weblink serves as a way to represent it however you want in the menus.

Related

Movable Type archive pages – show all entries in a top-level category or its subcategories

I have a MT blog. Originally it had a bunch of categories:
Apple
Pear
Banana
Grape
We've expanded our content and created some parent categories:
Animal
Dog
Cat
Duck
Vegetable
Apple
Pear
Banana
Grape
Mineral
Iron
Copper
Silver
All of the newly-written Entries have been added to both the top-level category and whatever sub-categories are appropriate. However, the old entries are only tagged with the original category they belonged to, which is now a subcategory. Therefore, the old entries do not appear in the category index pages for top-level categories (Animal/, Vegetable/, or Mineral/).
We don't want to have to manually edit every single old entry to add the correct top-level category. Is there a way to tell the Category Archive / Index page to include any entry that either in the TLC or one of its subcategories, without duplicating the entries? In other words, "Mineral" should list unique entries that are in Mineral, Iron, Copper, or Silver.
Any other suggestions?
If you are in an 'entry listing' (category archive) context/template it should be enough to add:
include_subcategories="1"
to your 'mt:Entries' loop, just like on this sample:
<mt:Entries include_subcategories="1">
...
</mt:Entries>
You may have to add at least one entry directly to the parent / top-level category to get the page to generate.
Update:
As Mihai pointed out, you actually can just use the include_subcategories="1" modifier to do this. Just tested and verified, and no plugins required. Save my solution for a more complicated module that needs to pull entries from other categories entirely. ;-)
This is difficult by default because Movable Type’s entry listing templates automatically inherit a specific context from which to pull entries or pages.
One possible solution is using the Out Of Context plugin, which gives you a new OutOfContext block tag that you can use to break out of the context that is currently limiting you to pulling entries from a specific category.
Your code might look something like:
<mt:CategoryLabel setvar="cat_label">
<mt:OutOfContext>
<mt:Entries category="$cat_label" include_subcategories="1" lastn="0">
<!-- entry code here -->
</mt:Entries>
</mt:OutOfContext>
I didn’t test this particular example, so please let me know if you try it!

get document by id in modx

Very simply I want to have multiple content regions on a single page. Note this is my first Modx site.
So far I have the home page and created child documents for the sub regions on the home page. All I want is to call them in the template.
For example there is a document with an id of 2, and I want the long title on the home page (id of 1).
Something like :
[[~2*longtitle]]
Unfortunately the above just returns the url to that sub document and not the longtitle of that document itself.
So far I've found no documentation on doing so. Does anyone know how to accomplish this?
You have 2 options, the hard way ~ the route you have chosen ;) and the easy way... which I will outline as well.
For what you are trying to do you are going to want to use either getResources http://rtfm.modx.com/display/ADDON/getResources which will allow you to loop over a collection of resources & extract the fields you need [in this case 'content'] or getresourceField http://rtfm.modx.com/display/ADDON/getResourceField which will allow you to specify a single resource & the field to extract, just call it multiple times in your template.
You might try:
[[getResources? &parents='[[*id]]' &tpl='myTpl' &includeContent='1']]
Should get all the child resources [up to default ~ 10] of the current resource, then you would create a template for get resources to loop over:
<h1>[[+longtitle]]</h1>
<p>[[+content]]</p>
notice the use of + instead of * for the resource fields
OR
the easy way, create template variables for your extra content areas, you can set them up as rich text areas as well. that way all your content for any given page is within the one resource ~ no need for you to create child resources to hold content for your header/footer/sidebar/etc
Either way will work, the TV method may use less overhead though.
you can use fastfield
[[#12.pagetitle]]
or in a call
[[#[[+id]].pagetitle]]
You can also grab all TVs of that resource, like
[[#12.myTv]]
see also: http://rtfm.modx.com/extras/revo/fastfield

using the comment system on a page that isn't associated with one entry

I would like to have comments enabled for a page that loops through entries of each categories and displays a summary (essentially a start page) with comments at the bottom. How can I make use of the commenting system in such cases where it is not a particular entry?
Do you need to use ee for comments? If not try disqus.
If that's not an option you'll need to create a ee entry for each category to allow commenting. One possible way to do this would be to create an entry for each category and then use custom category fields and create a cat-entry-I'd field to hold the categories entry. This

Please suggest a better property name for Items Order Index (in a list)

Hi I have a class of let's say "Channels", like folders - but it could be menu items in a navigation block. So obviously a "Channel" has properties like
.Title
.Alias (wordPress slug-like)
.Content
.RedirectUrl (may act as a hyperlink)
.StateProperties.IsActive
.StateProperties.IsFeatured
/// etc..
but in many cases I would want to set the order of my items in a navigation menu block manually - by whatever importance I decide, right.. ? (not by abc or timestamp)
So I've added a property called
StateProperties.OrderIndex just for this... a colleague of mine has called it "z-index" while he was referring to it... I am trying to build a CMS framework for our internal needs and just seeking your opinions as to what name could possibly be used for my "OrderIndex" ?
To me "OrderIndex" just makes sense :)
I believe 'OrderIndex' is exactly what you are looking for, since index stands for position and you are setting an 'Order' position. The 'Z' in 'z-index' stands for depth position, which does not seem to match what you are trying to go for.
I would prefer Order or Sequence. I think z-index carries a different meaning that what you're after (more for ordering on a stack).

Customizing gallery layout in Drupal with Views and CCK

I am creating a gallery/albums site in Drupal 6.
Perhaps the description will be a bit detailed, but still on some reason it's a problem to create a gallery in Drupal in a simple way.
As for now I am using CCK + Views + FileField + ImageCache + Lightbox2 combination.
This has allowed me to
- create Album CCK node type that can hold multiple images
- create a view that displays Albums in 9x9 fashion (using pager and items per row)
But here is one problem. While the main 9x9 view with albums displays nicely, when I drill down into particular Album node by clicking it's picture, it displays the uploaded node images in a vertical row and I am unable to control it's formatting.
Apparently, I have 2 options
a) to somehow control the html output of my CCK field with its files (to divide into rows)
b) or to create another view to display pictures from one album
As for now, I am not sure which of these two ways is the best and what specifically I need to do.
a) I can create node-album.tpl file - but all its content will already be in a single $content variable, which I don't be able to break into 3 items in a row. Am I wrong?
b) if I decide to create a view to display items from a single Album node, I am not sure how I reference it from the parent Albums view. The problem is that in view's Fields section I am able to override the Link, but it offers only 2 replacement patterns to pass to a potential "child" view, which are [title] and [field_images_fid] - is that enough to create a child view to show images from a specific album?
I just recorded a screencast outlining one approach. There's quite a bit of discussion in the comment threads about alternative methods; I'd definitely suggest using Views Attach if you want more control over the presentation of the gallery itself.
I can create node-album.tpl file - but all its content will already be in a single $content variable, which I don't be able to break into 3 items in a row. Am I wrong?
You are right and wrong.
In your template.php file you can pass other variables into your node-album.tpl, you could pass in the $node variable and display in a very customised way, although this will remove flexibility later on, as if you use another module to add things to $content you will have to edit the tpl file to access new variables.
To do this you use the preprocess_page hook in the template.php file. You can add variables to the $vars array and use these in the node-album.tpl file. I think that $node will already be defined in the tpl file, which will probably make your life easier. you can disregard content altogether.
If this doesn’t work for you, you can also create a custom module and use hook_nodeapi and hook_theme to theme things any way you like, while still using $content. However this may be a bit too much work for you needs (if you want to go this way, reply and I'll write a separate answer).

Resources