Login   Register  
PHP Classes
elePHPant
Icontem

better cms

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP Classes blog  >  MODX: A CMS Framework...  >  All threads  >  better cms  >  (Un) Subscribe thread alerts  
Subject:better cms
Summary:modx vs wordpress
Messages:7
Author:zetoun
Date:2011-09-22 19:47:33
Update:2011-09-24 00:34:44
 

  1. better cms   Reply  
Picture of zetoun
zetoun
2011-09-22 21:14:56
modx vs wordpress

modx:
$resource = $modx->getObject('modResource',array('pagetitle'=>'MyDocument'));
$output = '<p>Document:' . $resource->get('longtitle') . '</p>';

wordpress :
$output = get_the_title();

cant be easier :)

  2. Re: better cms   Reply  
Picture of Stephane Boualrd
Stephane Boualrd
2011-09-22 23:08:22 - In reply to message 1 from zetoun
Your examples are a little biased.

First, in the document (and within a snippet since you're using php directly), you have directly access to the resource object.
So you can just return the needed field without querying it :

<?php return $modx->resource->get('pagetitle');

But in your example, you wrap the title within paragraphs.

Therefore you should show the real example in wordpress:

<p><?php get_the_title(); ?></p>

And then the same output with modx template tags:

<p>[[*pagetitle]]</p>

Now this is easier :)

  3. Re: better cms   Reply  
Picture of Mark Hamstra
Mark Hamstra
2011-09-23 03:42:31 - In reply to message 1 from zetoun
What's even more weird about your example is that you are first using the pagetitle to fetch a resource. Titles aren't necessarily unique so that's one flaw.

And then you're using that to output the longtitle? There would be no situation in which you would have access to the the pagetitle, but not the longtitle.


As the examples that Lossendae posted shows, you would not need to know PHP syntax to perform those really essential tasks of, like, displaying content.

Granted that this is a php community, stuff like that shouldn't need a programming language.

  4. Re: better cms   Reply  
Picture of W. Shawn Wilkerson
W. Shawn Wilkerson
2011-09-23 03:44:28 - In reply to message 1 from zetoun
Ummm...

[[*pagetitle]] trumps

$output = get_the_title();

  5. Re: better cms   Reply  
Picture of Bob Ray
Bob Ray
2011-09-23 03:45:24 - In reply to message 2 from Stephane Boualrd
Your example is not a good one, but there are certainly things that are easier to do in WordPress than MODX (and vice versa).

If you want a simple blog and can find an existing theme that meets your needs, WordPress is hard to beat. There are many things, though, that are trivially easy to do in MODX that are very difficult in WordPress.

I would be curious to see the WordPress code to print the title and summary fields of all documents edited, but not necessarily created or published by the user viewing the current page, using a mini-template for formatting them (and to hear whether you can produce the code off the top of your head).

Here it is for MODX Revolution:

Tpl chunk (let's call it 'listTpl'):

<p class = "pagetitle">Page Title: [[+pagetitle]]</p>
<p class = "summary">Summary: [[+introtext]]</p>


Snippet code:
<?php
/* three lines for clarity, but could easily be a single line */
$userID = $modx->user->get('id');
$c = array('published'=>'1','deleted'=>'0','editedby'=>$userId);
$docs = $modx->getCollection('modResource', $c);

foreach($docs as $doc) {
$output .= $modx->getChunk('listTpl',$doc->toArray());
}

$return $output;

The code above took about 3 minutes to write. Note that all fields of the document are available, so redesigning the output and adding other document fields is just a matter of editing the Tpl chunk and adding the appropriate HTML and placeholder tags.

  6. Re: better cms   Reply  
Picture of zetoun
zetoun
2011-09-23 15:13:03 - In reply to message 5 from Bob Ray
here is the wordpress version :

author-1.php (with that filename it will display only author id=1 published posts, smart and simple)

<?php while ( have_posts() ) { the_post(); ?>
<p class = "pagetitle">Page Title: <?php the_title() ?></p>
<p class = "summary">Summary: <?php the_excerpt() ?> </p>
}



i my opinion modx seem really powerful on medium/big web site, but for small blog/ecommerce i prefer WP :)

  7. Re: better cms   Reply  
Picture of Bob Ray
Bob Ray
2011-09-24 00:34:44 - In reply to message 6 from zetoun
Sorry, but that's not even close to the WordPress version of the code above.

The task was to show posts *edited* by that user -- including posts not necessarily created or published by that user.

And to use a template to format the output so that the fields included and the output format could be changed without touching the code.