Topic: few categories

Hi guys. I have a question. It`s  possible to show few categories? For example, I have 3 folder in "content" folder like a "notes", "article" and "media". How I can show this categories in index page?

Thanks )

2 (edited by tovic 2014-03-06 00:17:30)

Re: few categories

Create index.md file for each folder after content folder with content of this:

Title: Your Sub-Pages Title
Description: Lorem ipsum dolor sit amet.
Template: blog

----

So…

→ /content/
    → index.md
    → 404.md
    → /notes/
        → index.md
        → another-post-1.md
        → another-post-2.md
    → /article/
        → index.md
        → another-post-1.md
        → another-post-2.md
    → /media/
        → index.md
        → another-post-1.md
        → another-post-2.md

In your content > index.md file, change its content to this:

Title: Test Title
Description: List of few categories...
Template: custom-index

----

Then create new theme file custom-index.html

<?php include 'header.html' ?>
<?php include 'navbar.html' ?>
<div class="container">
<?php Morfy::factory()->runAction('theme_content_before'); ?>

<?php

$paths = array();

if($handle = opendir(CONTENT_PATH)) {
    while(false !== ($path = readdir($handle))) {
        if(
            $path != '.'
            && $path != '..'
            && $path != 'index.md'
            && $path != '404.md'
            && $path != 'about.md'
        ) {
            $paths[] = $path;
        }
    }
    closedir($handle);
}

// var_dump($paths);

foreach($paths as $path) {
    $file = Morfy::factory()->getPage($path);
    echo '<h3><a href="' . $path . '">' . $file['title'] . '</a></h3>';
    echo '<p>' . $file['description'] . '</p>';
}

?>

<?php Morfy::factory()->runAction('theme_content_after'); ?>
</div>
<?php include 'footer.html' ?>
XSS Testing <script>alert('HIYAA!!!');</script>

Re: few categories

Thanks for answer tovic) But I got something like this(

http://cl.ly/UFrA/Screen%20Shot%202014-03-05%20at%2021.38.00.png

what am I doing wrong?

4 (edited by tovic 2014-03-12 01:12:41)

Re: few categories

When clicked, are they go to the correct page?

You have to edit each Title field in this file to create meaningful sub-page name:

→ /content/
    → index.md
    → 404.md
    → /notes/
        → index.md <=== this
        → another-post-1.md
        → another-post-2.md
    → /article/
        → index.md <=== this
        → another-post-1.md
        → another-post-2.md
    → /media/
        → index.md <=== this
        → another-post-1.md
        → another-post-2.md

PS: I have updated the file loop above. Please replace the old loop.

XSS Testing <script>alert('HIYAA!!!');</script>

Re: few categories

I'm sorry for my tardiness, tovic! I did everything you said, but I have only three links.

http://cl.ly/UN92/Screen%20Shot%202014-03-11%20at%2013.45.28.png

This is my content folder. Maybe I missed something?

content.zip (12 KB)

Re: few categories

3 folders of course will produce 3 links. I thought that’s what you expected. Am I misunderstood about the term of “few category”?

XSS Testing <script>alert('HIYAA!!!');</script>