Query Pages

Feed 8 posts, 4 voices

Avatar
10 posts

I’m sure this question has been answered somewhere else on this forum, but i’m having an awful hard time finding the answer… I want to be able to on a given page “Get all entries with ‘X’ tag”, and then list them by date. I’m sure this is very easy to do and probably has something to do with the tagger plugin, but i’ve read the documentation and it’s still clear as mud….. :/

 
Avatar
3 posts

I’m not sure this is what you’re looking for, but, basically, what you gotta do is:

  • create a MySQL query to retrieve the entries that you’re looking for
  • then create a PHP loop that lists those datas depending on how you want it to look like (e.g. <article title> – by <autor> on <date>)

A website that can help

You’ll get the MySQL connect infos in the config.php file, while the tables and fields names can be found using Phpmyadmin (ask your webhost for the url).

———

[EDIT]

Frog is brand new for me, and I just discovered an easier way to use queries:

$data = $this->children(array('limit'=>5, 'order'=>'page.created_on DESC'));

where:

  • $data -> stuff you want to display
  • $this -> the page you’re editing
  • children() -> act on the children “pages” of $this
  • array() -> here’s your query!

Let me try to translate the query in Shakespeare english:

select 5 "pages" among the children ones, from the biggest timestamp to the smallest timestamp

What are those timestamps?
If you wanna select them all, put no “limit” condition.

 
Avatar
1493 posts

@jedd — that’s some helpful “developer” type stuff. Thanks!

@bdkalwat — if you’re not quite ready to “roll your own”, you might try this page-part ordering plugin. It doesn’t use tags, but there are some advantages to using page-parts (the little green “+” icon [and red “-” icon] along the top of the page editing area).

The plugin deals with children pages, so that is one thing to be aware of. You can see it at work on this page (at the moment!) — all the pages having a “date” page part are listed; but you’ll notice a “London” entry in the sidebar. It does not have the “date” page-part, and so is omitted from the plugin-produced list on the page.

Hope that helps!

 
Avatar
10 posts

This is great information guys, thanks for taking time to spell it out. I’m wondering also though, is there a way to get around children? Is it possible to make a page that retrieves all pages throughout the entire site with a common “page part” (green + field)? Thanks in advance for trying to understand all of this… :D

[EDIT]

OK, so I think the better idea here would be for me to give an example of what i’m trying to accomplish. Basically, I think my question comes down to this – Does this code “$data = $this->children(array(‘limit’=>5, ‘order’=>‘page.created_on <span class=“caps”>DESC</span>’));” also work for children’s children? (I know – ridiculous….)

Here’s my current sitemap

Home

About

News – Region 1 Region 2 Region 3….

Classifieds – Region 1 Region 2 Region 3….

Contact

Basically – each “Region” page is just an archive of all of the News or Classifieds from that region – but on the MAIN News & Classifieds pages, I’d like to list say 5-10 of the most recent pages from ALL regions. I feel like i’m doing a fairly good job explaining this clearly….hopefully you guys understand what i’m going for! Thanks in advance!

 
Avatar
1493 posts

From what you describe, I think mtylerb’s Advanced Find plugin might do the trick. It is set up to handle archive (blog-like) pages at the moment, but perhaps it could be coaxed into doing your job.

A lot of forum regulars are taking time away over the holiday period, so you might need to hold on a bit before getting more definitive answers. Or maybe that will be enough to get you going!

 
Avatar
10 posts

David, I feel like you’re right – this plugin should work for what I’m trying to do, but I must be doing something wrong. I’ve installed the plugin from the admin panel, and this is my code:

<?php $articles = adv_find(
array('classifieds-archive/northwoods/', 'classifieds-archive/western/', 'classifieds-archive/twin-cities/'),
array('order' => 'published_on DESC')); ?>

I’m trying to list pages from multiple archives, in chronological order (most recent first). I feel like this is a downfall of FrogCMS, being that there is no distinction between pages and posts…it probably isn’t, if you know how to get the framework to do what you want it to…. :D

P.S….if you could explain how this bc. & bc.. crap works…that’d be awesome, I feel like a moron sitting here clicking preview 50 billion times!

 
Avatar
1493 posts

if you could explain how this bc. & bc.. crap works…

LOL :) You can see more about how the Textile filter works at Textism. There are some quirks in the way it works in this forum, however.

I’ve edited your previous note, so the easiest thing is just to look at it again (with the “Edit Post” thing), and see the way it looks now. Hopfully that will make sense of things for you!

 
Avatar
10 posts

Thanks for the help… I was thinking that it was like tags where you had an open <bc..> and a close afterwords </bc..>… This is even easier.

 
Avatar
316 posts

bdkalwat – if you need any help with the plugin, feel free to use the contact form on my site to email me and I will do my best to respond ASAP. I’m not gone, entirely, I’m just dealing with a really big helping of life, on my plate. :-) Hopefully that made sense.