Displaying content

FMS uses a single object to display all of your content, whether it be layouts or graphics. You can run a number of options through it to get it looking just how you want it.

Here's an example of displaying 15 graphics per page, with descriptions hidden.

<?php echo $fms->content( array('type' => 'gallery', 'limit' => 15, 'description' => false) ) ?>


Searching content

Permalink · Back to top

You can also use the $fms->content() object to search your content. By passing another argument after the array of options, FMS will search your database for content related to those keywords. For example, to use the same display as above, but search for “colorful”, you can use:

<?php echo $fms->content( array('type' => 'gallery', 'limit' => 15, 'description' => false) , 'colorful' ) ?>

If you were to run a query in a search form, you can use the result of the query. If you were to use a “get” method for the form, the query might look something like this:

<?php echo $fms->content( array('type' => 'gallery', 'limit' => 15, 'description' => false) , $_GET['for'] ) ?>


Custom displays

Permalink · Back to top

If you don't like the default display of the content, you can customize how it's shown to your visitors by using $fms->retrieve() with the same arguments as $fms->content(). Instead of giving you HTML output, $fms->retrieve() will give you an array of all of your content. To display it, you can use a script similar to this:

<?php $limit = 15; $content = $fms->retrieve( array('type' => 'gallery', 'limit' => $limit) ); $pages = list_pages($content['total'], $limit); unset($content['total']); ?> <ul> <?php foreach($content as $item) : ?> <li> <?php echo $item['name']; // Displays the title ?> <?php echo $item['thumb']; // Displays the thumbnail URL ?> <?php echo $item['slug']; // Displays the content URL ?> </li> <?php endforeach; ?> </ul> <?php echo $pages; // Displays the list of pages ?>


The complete list of options

Permalink · Back to top

  • type

    Get the type of content (gallery or layouts). If no type is defined, defaults to layouts

  • name

    Displays the title of the layout or image. You can use true or false. Defaults to true

  • date

    Displays the date; true or false; defaults to true

  • tags

    Displays linked tags, if available; true or false; defaults to true

  • description

    Displays the description, if available; true or false; defaults to true

  • show_cat

    Shows the category the layout or image was filed under; true or false; defaults to true

  • category

    Displays content from a specific category ID

  • order

    Displays content by the database column: type, name, date, or category. Defaults to date

  • sort

    Sorts the list of content; ASC or DESC; defaults to DESC

  • limit

    Sets the number of items to display per page. Defaults to the value set in your admin panel.

  • details

    If set to false, only a linked thumbnail is displayed. Defaults to true

  • time

    If set to true, also displays the time along with the date. Defaults to true

  • list

    The HTML tag to surround each layout or image (li will display as <li>content</li>). Defaults to li

  • width

    If larger than 0, sets the width of the content's thumbnail. Defaults to 150

  • height

    If larger than 0, sets the height of the content's thumbnail. Defaults to 0

  • pages

    Displays the list of pages at the top, bottom or both. Defaults to bottom

  • code

    If set to true, will display the code for the content. Defaults to false