Old 25-11-2009, 16:19   #1 (permalink)
Tom
Space Monkey
 
Tom's Avatar
 
Join Date: Jan 2007
Posts: 10,448
MODx – Resources

Sticky thread dedicated to MODx CMS.

Quite a few people now using/interested in it on here now – post resources and tips and I'll sort it out as we go.

Any pointless crap will be deleted.

Official Site + Resources:
Content Management System, Framework, and More - MODx
Developer's Guide - MODx Documentation


Official Community Forum:
MODx Community Forums - Index


MODx Book:
MODx Web Development: Amazon.co.uk: Antano Solar John: Books


MODx Tutorials:
Working With a Content Management Framework: MODx - Nettuts+

Last edited by Tom : 25-11-2009 at 16:59.
  Reply With Quote
Old 25-11-2009, 16:44   #2 (permalink)
pedge
Crazy diamond...
 
pedge's Avatar
 
Join Date: Apr 2004
Location: In my own little world...
Posts: 1,159
An outline of how a blog in modX works:

It is a bit complicated at first, but you just use the built in 'Ditto' plugin. If I recall, this is how you set it up to begin with:

1. Create a new page (lets call it 'Blog') in the manager, edit it and click on Page Settings tab and deselect Rich Text. Save it and then put this code:

[!Ditto? &startID=`45`&sortBy=`createdon` &sortDir=`DESC` &summarize=`5`  &total=`5`&tpl=`blogclip`!]

into its Document Content.

2. 'blogclip' (referred to in above) is a chunk of that name containing something like:

<h1><a href="[~[+id+]~]">[+longtitle+]</a></h1>
<h3>[+introtext+]</h3>
<p><a href="[~[+id+]~]">Read this post.</a></p>
<h6>Posted on [+date+]<h6>

You only need to create this once - you can add images and stuff to it if you want. This is the template your blog previews will use.

3. Now whenever you want to create your post, just right click on 'Blog' in the manager and select Create document here.

4. You put some preview text which is shown in the chunk into Summary (introtext) area and the main content of the post goes into the Document Content. Save it and publish it and it should appear when you click 'Blog' on your navigation.

That's basically it - its long winded compared to Wordpress but its not meant to be blogging software; the above works for blogs as well as news pages, job postings etc.
__________________
Effervescing Elephant
  Reply With Quote
Old 25-11-2009, 16:46   #3 (permalink)
pedge
Crazy diamond...
 
pedge's Avatar
 
Join Date: Apr 2004
Location: In my own little world...
Posts: 1,159
Setting up templates:

Thing about modX, you don't need to understand PHP - so long as you can install it (using the installer), set up a MYSQL database and chmod permissions if needed, its all done via the Manager frontend. Here's some tips for the 'Resources > Manage Resources' tab which is what you will use most of the time:

Templates - this is where you create a template which contains the body of your webpage. You can make as many templates as you want which means every page you make you can choose a different template for (ideal for portfolios etc). So make your webpage in dreamweaver or Coda etc and copy the code and paste it into your new template. Then, go through it and strip out any placeholder text and replace it with modX tags (such as [*content*] for the main content and [*pagetitle*] for the page title) or template variables which are custom tags you make up...

Template variables - these are custom placeholders; so if you want a picture to appear in a specific place you create a new template variable (TV) and assign it a value such as an image etc. So, you create a TV with a name (lets call it MyMainImage) and refer to it in your main layout/template (where you want MyMainImage to appear) using [*MyMainImage*]. When you're entering the content of your page, as you scroll down it you will find a new field where you can select your image. When you save the page (and publish it) and view it you will see where [*MyMainImage*] is referred it now has the image you selected. That's basically how they work...

Chunks - these are chunks(!) of reusable code which you can place on each page; so you could do your main navigation as a chunk and refer to it in the template and then everytime you need to tweak the nav you just tweak the chunk and that's it. Its also used for Ditto (the blog thing I mentioned above) where the code is (I believe) parsed and actioned when the chunk is called. I'm no coder - probably didn't explain that properly but thats what it does for me...

Snippets - not done a lot with these but they can be used to logically determine who is logged in, do dynamic menus, process forms and do search functions etc.

Meta Tags & Keywords - you can set it to automatically add meta tags etc from the 'Resources > Manage Meta Tags & Keywords' section - define them in there and then when you create or edit a page you can select the ones you want to use from your predefined list.

That's a brief overview - I'm no coder so sorry if I muxed up the jargon but the modX developer guide answers all your questions and the forums are even better.

Read more here: Developer's Guide - MODx Documentation

MODx Community Forums - Index
__________________
Effervescing Elephant
  Reply With Quote
Old 01-12-2009, 11:32   #4 (permalink)
b.
mongulated
 
b.'s Avatar
 
Join Date: Apr 2008
Location: Brisbane, Australia
Posts: 3,744
Hey pedge, did you use a tutorial when you started? Any you could recommend? I was thinking of the starting the nettutes one that tom posted.
__________________
Last edited by b. : Tomorrow at 01:51.
  Reply With Quote
Old 01-12-2009, 12:11   #5 (permalink)
pedge
Crazy diamond...
 
pedge's Avatar
 
Join Date: Apr 2004
Location: In my own little world...
Posts: 1,159
I just got down and dirty with it - its really straight forward once you know that you just drop your code in and basically replace it with placeholder code; it was the ditto blog/news part that I struggled with, but hopefully the code above (post #2) should shed more light on it than was available when I tried it.

Working With a Content Management Framework: MODx - Nettuts+
__________________
Effervescing Elephant
  Reply With Quote
Old 01-12-2009, 13:19   #6 (permalink)
b.
mongulated
 
b.'s Avatar
 
Join Date: Apr 2008
Location: Brisbane, Australia
Posts: 3,744
Yeah - started that one an hour ago. I can't believe how simple it is once you start getting your head around the interface.

I'm in CMS learning mode today. Took Pulse for spin - it's almost hilarious how simple that one is. Once I'd warmed myself up I thought, 'why not have a go at modx.' I'm so glad I did
__________________
Last edited by b. : Tomorrow at 01:51.
  Reply With Quote
Old 01-12-2009, 13:31   #7 (permalink)
b.
mongulated
 
b.'s Avatar
 
Join Date: Apr 2008
Location: Brisbane, Australia
Posts: 3,744
Quote:
Our next step is to work with the 'content' template by adding the placeholders for the dynamic content. You can either open the template directly in the Manager or use an external code editor of your choice and paste code back into MODx when you are finished (note: you can also keep your template files as external 'include' files if you want, but we will not cover that in this tutorial).

So you can't open the actual templates directly in an editor? Seems abit annoying.
__________________
Last edited by b. : Tomorrow at 01:51.
  Reply With Quote
Old 01-12-2009, 13:38   #8 (permalink)
Tekka
Slam in the Lamb
 
Tekka's Avatar
 
Join Date: Nov 2009
Location: Leicestershire, UK
Posts: 559
Can't you just copy and paste the code?
  Reply With Quote
Old 01-12-2009, 14:13   #9 (permalink)
b.
mongulated
 
b.'s Avatar
 
Join Date: Apr 2008
Location: Brisbane, Australia
Posts: 3,744
With Wordpress you can edit the templates directly - they're files. Modx stores them away in the database. It means I can't use Coda's built in ftp to edit template files directly. Yes, yes, I know you can copy and paste or use snippets, but it still feels so awkward that you cant just edit the damn things!

Quote:
As this was the first drawback I encountered, I feel quite strongly about this. I will do the steps you mentioned, but I think that if this functionality is not out of the box then it is still a flaw. I should not have to make custom PHP templates or use firefox plugins to provide me what I consider to be standard functionality. ModX is a great system and I know its not hit the big version '1' yet but I still think that is has lot of areas it needs to improve on.

My workflow should be, edit in my editor and deploy to dev/live. Duplicating content and adding other factors in the chain promotes extra margins for error and a disjointed working practice.

A question about templating in the databse - and why it seems like a flaw to me.

There a some solutions on that thread, but I'm still not happy. It's one flaw in what seems like a great system.

</rant>
__________________
Last edited by b. : Tomorrow at 01:51.
  Reply With Quote
Old 01-12-2009, 14:27   #10 (permalink)
pedge
Crazy diamond...
 
pedge's Avatar
 
Join Date: Apr 2004
Location: In my own little world...
Posts: 1,159
You can always edit the template code directly in the Manager, save it (and click the radio button that saves it but doesn't close the page) and preview/refresh a test page in your browser - that's what I do...
__________________
Effervescing Elephant
  Reply With Quote
Old 01-12-2009, 14:59   #11 (permalink)
b.
mongulated
 
b.'s Avatar
 
Join Date: Apr 2008
Location: Brisbane, Australia
Posts: 3,744
Quote:
Originally Posted by pedge
You can always edit the template code directly in the Manager, save it (and click the radio button that saves it but doesn't close the page) and preview/refresh a test page in your browser - that's what I do...
No syntax highlighting? No added functionality that you'd get from a dedicated editor? I didn't buy Coda for nothing you know.
__________________
Last edited by b. : Tomorrow at 01:51.
  Reply With Quote
Old 01-12-2009, 15:03   #12 (permalink)
pedge
Crazy diamond...
 
pedge's Avatar
 
Join Date: Apr 2004
Location: In my own little world...
Posts: 1,159
Haha, I love Coda too - reminds me; seem to get a lot of port errors lately for some reason, gonna have to speak to my host to see if there's a problem on their side...
__________________
Effervescing Elephant
  Reply With Quote
Old 01-12-2009, 15:21   #13 (permalink)
b.
mongulated
 
b.'s Avatar
 
Join Date: Apr 2008
Location: Brisbane, Australia
Posts: 3,744
Anyway, I put a thread up on the forums and a guy linked me to this: Edit templates outside of modx

This is what you put in the manager:
HTML Code:
[[includeTemplate? &tpl=`business/awards-list.html`]]

This is the snippet:
PHP Code:
<?php
# Snippet to include template files from file system
# USAGE: [[includeTemplate? &tpl=`mytemplate/template.html`]]

if ( !isset($tpl) || $tpl== "" ) return "Missing Template file!";

$tpl $base_path .'assets/templates/'.$tpl;
ob_start();
include(
$tpl);
return 
ob_get_clean();
?>

It's doesn't fulfil my wish for external template files, but it'll do the job.
__________________
Last edited by b. : Tomorrow at 01:51.

Last edited by b. : 01-12-2009 at 15:31.
  Reply With Quote
Old 01-12-2009, 15:52   #14 (permalink)
pedge
Crazy diamond...
 
pedge's Avatar
 
Join Date: Apr 2004
Location: In my own little world...
Posts: 1,159
MODx Image Gallery with ratings etc

There's one at Package: MaxiGallery | MODx CMS / CMF which I think generates thumbnails etc and there's probably others in the Packages: Gallery | MODx CMS / CMF section.

I found a star rating plugin: Package: AnythingRating | MODx CMS / CMF
Documentation here: AnythingRating - MODx Wiki

Some examples of how to use it with maxiGallery: Anything Rating | Home
Code:
Wangba | With Maxigallery and Jot

Demos:
Anything Rating | Portraits
Anything Rating | Travel
__________________
Effervescing Elephant

Last edited by Tom : 02-12-2009 at 10:30.
  Reply With Quote
Old 02-12-2009, 12:21   #15 (permalink)
Tom
Space Monkey
 
Tom's Avatar
 
Join Date: Jan 2007
Posts: 10,448
Quote:
Originally Posted by bjzaba
So do I get any thanks for doing your googling?

Was it any use to you?

Strewth, of course you do cobber, many thanks bjzaba.

Yes it was useful, what you kindly found showed it's perfectly possible, although not as 'in-the-box' as the Expression Engine gallery, but I guess you can't have it all.

Only reason I'm merging/deleting posts is to try and keep all main resources neat/tidy and hopefully on the first page, will keep changing it as we go.

All posts without resources or tips (like this one and your last one) will get deleted after a couple of hours, will turn into a shambles otherwise…
  Reply With Quote
Old 02-12-2009, 12:49   #16 (permalink)
b.
mongulated
 
b.'s Avatar
 
Join Date: Apr 2008
Location: Brisbane, Australia
Posts: 3,744
Haha - no problem dude. Just took me by surprise that's all.

Quote:
Originally Posted by Tom_E
Yes it was useful, what you kindly found showed it's perfectly possible, although not as 'in-the-box' as the Expression Engine gallery, but I guess you can't have it all.
I guess that's what they're saying, modx is more a framework than a CMS. It's flexible, but you have to roll your own.
__________________
Last edited by b. : Tomorrow at 01:51.
  Reply With Quote
Old 08-01-2010, 16:26   #17 (permalink)
7twelve
42nd amendment
 
7twelve's Avatar
 
Join Date: Aug 2008
Posts: 872
Quote:
Originally Posted by bjzaba
It's doesn't fulfil my wish for external template files, but it'll do the job.

How so? All of your template, chunk and snippet calls would reside in an external file you can create using any method you would want. All you're really doing is tell MODx to parse the template in a different fashion than by original design.

One thing to note tho, in using that method (in order to get certain dynamic snippets like ditto, reflect or jot) you need to run it cached ( [[ ]], not [! !] ) - so any time you update the template itself, you'd need to flush the cache in the manager for the changes to take effect.

One of the strengths of MODx IMO is it is terribly easy to either roll your own solution, or easily integrate an existing one - either as a snippet or a module. I've done a few custom database interfaces this way, as well as integrating simplepie (FeedX just didn't have the depth I needed) in a few minutes.

Of course, if you're looking for an all-in-one, out of the box solution (especially if a Blog is a primary focus)...MODx might not suit your needs.

And for a tip, if you want a dual menu system - combine Wayfinder with UltimateParent like thus:

Menu level 1
Code:
[!Wayfinder?&selfClass=`nav_here` &startId=`0` &level=`1` &outerTpl=`outerTpl` &rowTpl=`rowTpl`!]

Menu level 2
Code:
[!Wayfinder? &selfClass=`nav_here` &startId=`[[UltimateParent? &topLevel=`1`]]` &level=`1` &outerTpl=`outerTpl` &rowTpl=`rowTpl`!]

that will allow the second menu to see where it is in relation with the first menu
  Reply With Quote
Old 24-03-2010, 17:32   #18 (permalink)
pedge
Crazy diamond...
 
pedge's Avatar
 
Join Date: Apr 2004
Location: In my own little world...
Posts: 1,159
Something I found out recently was how to add Canonical linking to a ModX site, the link is below but it boils down to this:

For your homepage only, add this to your template:
<link rel="canonical" href="[(site_url)]" />

For all other pages on the site, add this:
<link rel="canonical" href="[(site_url)][~[*id*]~]" />

This means your homepage needs to use a different template to the rest of the site (no big deal to be honest), but you can install something called PHx which extends placeholders so that one piece of code will do the entire site which (if PHx is installed) is:

[+phx:if=`[*id*]`:is=`1`:then=`<link rel="canonical" href="[(site_url)]" />`:else=`<link rel="canonical" href="[(site_url)][~[*id*]~]" />`+]

It all goes into the head tag.

Canonical URL tag in MODx - SEO trick
__________________
Effervescing Elephant
  Reply With Quote
Old 08-07-2010, 11:26   #19 (permalink)
pagey
.
 
pagey's Avatar
 
Join Date: Aug 2006
Location: .
Posts: 1,733
Bit of a shot in the dark here, but I'm having an issue with a MODx site that I'm working on...

Ok,

I've just put a new site live. It features a Flash banner which is pulling in some images via XML.

I've set the host headers on my server (IIS 6) to 'www.mydomain.co.uk', and also my 'mydomain.co.uk'. The site loads using both of these URLs, but my Flash banner only works with one of them (whichever one its picking up as the site_url variable).

At the top of my template, I have <base href="[(site_url)]"> and this makes all the links automaticvally start with www.mydomain.co.uk. But when I access the site via mydomain.co.uk, it still sends the links to www.mydomain.co.uk, whereas I'd like it to go to just mydomain.co.uk.

Why is it doing this? Does anybody know how to fix this?I have static sites set up the same way and they work just fine and dandy.

Thanks
  Reply With Quote
Old 22-08-2010, 19:48   #20 (permalink)
7twelve
42nd amendment
 
7twelve's Avatar
 
Join Date: Aug 2008
Posts: 872
revo has been released - gonna play with it some and report back
  Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive
vBulletin © 2000-2009 Jelsoft Enterprises Limited.
Search Engine Optimization by vBSEO 3.0.0 RC8