Welcome Guest, Not a member yet? Register   Sign In
PyroCMS v0.9.9

[eluser]Phil Sturgeon[/eluser]
Nah he is right. In the world of Git we have the awesome staging area so we can chose what to commit in one go. You can even commit certain lins out of a file, which means the old SVN change-commit is redundant.

It's not massively important but I have to manually review each. As long as commits are logically groups (only relevant stuff in each commit) then the fewer the better.

I'll have a look at this later today, thanks Isern.

[eluser]Nurdin Bekkeldiev[/eluser]
Is there any nice solution for navigation module? I need submenu. Waiting for reply.

[eluser]Phil Sturgeon[/eluser]
You don't need to add "Waiting for reply." to each message. I will reply when I can (which is usually pretty quick anyway). Tongue

There is no sub-menu feature available just yet, there will be in v0.9.8.1.

If you need it sooner, feel free to develop a solution yourself and submit as a fork to GitHub.

[eluser]Nurdin Bekkeldiev[/eluser]
Thanks, I'll try to develop for myself.

Code:
foreach(navigation('sidebar') as $nav_link):
    if ($nav_link->parent == 0)  {
        $parent_menu[$nav_link->id]['label'] = $nav_link->title;
        $parent_menu[$nav_link->id]['link'] = $nav_link->url;
    } else {
        $sub_menu[$nav_link->id]['parent'] = $nav_link->parent;
        $sub_menu[$nav_link->id]['label'] = $nav_link->title;
        $sub_menu[$nav_link->id]['link'] = $nav_link->url;
        $parent_menu[$nav_link->parent]['count']++;
    }
    endforeach;

When I use this code, I'm getting this error

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined index: count

So what is the problem inside this code?

[eluser]Phil Sturgeon[/eluser]
The problem is that $parent_menu[$nav_link->parent]['count'] has not been defined before you are trying to increment the value. If you are new to CodeIgniter then you may not be used to having error reporting turned up so high.

This is normally the sort of thing that PHP will let you get away with, but not here sonny-jim! :lol:

Code:
foreach(navigation('sidebar') as $nav_link):
    if ($nav_link->parent == 0)  {
        $parent_menu[$nav_link->id]['label'] = $nav_link->title;
        $parent_menu[$nav_link->id]['link'] = $nav_link->url;
    } else {
        $sub_menu[$nav_link->id]['parent'] = $nav_link->parent;
        $sub_menu[$nav_link->id]['label'] = $nav_link->title;
        $sub_menu[$nav_link->id]['link'] = $nav_link->url;
        $sub_menu[$nav_link->id]['count'] = 0;
        $parent_menu[$nav_link->parent]['count']++;
    }
    endforeach;

[eluser]Nurdin Bekkeldiev[/eluser]
no, the problem is before that code. I mean
Code:
$sub_menu[$nav_link->id]['count'] = 0;

gives an error.

but the code below is working fine, because it was specified.
Code:
$parent_menu[$nav_link->parent]['count']++;

[eluser]Phil Sturgeon[/eluser]
Good luck working it out. Really mate, I can't help with every step. This is a basic PHP coding question.

[eluser]Nurdin Bekkeldiev[/eluser]
For those who really needs submenu solution for their PyroCMS project.

1. add parent_id column to your navigation_links column
2. add parent_id rules to your admin controller inside navigation module

Code:
$rules['parent_id'] = 'trim|numeric';

3. Admin_Controller add this code under _construct function

Code:
if($parentss = $this->navigation_m->get_parents())
        {
            foreach($parentss AS $parents)
            {
                $this->data->parentss[$parents->id] = $parents->title;
            }
        }

4. Add this code to navigation_m model

Code:
function get_parents()
    {
        $this->db->select('navigation_links.*');
        $this->db->where('parent_id',0);
        return $this->db->get('navigation_links')->result();
    }

5. Add this code to form.php at navigation module

Code:
<li class="even">
                    <label for="target">&lt;?php echo lang('nav_parent_label'); ?&gt;</label>
                    &lt;?php echo form_dropdown('parent_id', array(lang('nav_link_parent_select_default'))+$parentss, $navigation_link->parent_id) ?&gt;
                </li>

6. Add this function to navigation_helper

Code:
function generateMenu($array, $parent = 0, $level = 0)
{

  //
  // Reset the flag each time the function is called
  //
  $has_children = false;

  //
  // Loop through each item of the list array
  //
  foreach($array as $key => $value)
  {
    if ($value['parent_id'] == $parent)
    {                  

      //
      // Only print the wrapper ('<ul>') if this is the first child (otherwise just print the item)      
      // Will be false each time the function is called again
      //
      if ($has_children === false)
      {
        //
        // Switch the flag, start the list wrapper, increase the level count
        //
        $has_children = true;  

        echo '<ul class="level-' . $level . '">';

        $level++;
      }

      //
      // Print the list item
      //
      echo '<li><a href="?id=' . $value['id'] . '">' . $value['title'] . '</a>';

      //
      // Repeat function, using the current item's key (id) as the parent_id argument
      // Gives us a nested list of subcategories
      //
      generateMenu($array, $key, $level);

      //
      // Close the item
      //
      echo '</li>';


    }

  }

  //
  // If we opened the wrapper above, close it.
  //
  if ($has_children === true) echo '</ul>';


}

7. Call this menu inside leftnav.php "theme view folder"

Code:
foreach(navigation('sidebar') as $nav_link):
        $menus[$nav_link->id] = array(
            'id' => $nav_link->id,
            'title' => $nav_link->title,
            'parent_id' => $nav_link->parent_id
          );

    endforeach;
    
    echo generateMenu($menus);

8. Voila! main menu and sub menu solution is ready, but I hope in the next version it will be more easily done.

[eluser]ayukawaa[/eluser]
Hello,

I have read in another post that if I want another 'default' page I have to hard coded it (application/modules/core/pages/controllers/pages.php => private $default_segment = 'home'Wink

That is nonsense.

I just re-install the cms and after inserting my pages, I delete by error the example 'Home' page which is the 'default' page and then the default page change to "Page missing".

That is right (after all I delete it) but is there an option elsewhere IN THE ADMINISTRATION to select which is the default page?

What if I don't have easy access to the MySQL/code in the server?

If the default page CAN NOT BE CHANGED FROM THE ADMIN AREA, then I SHOULD NOT BE ALLOWED TO DELETE IT.

Or, if the system detects the default page no longer exists, then give a chance to select another one.

Thanks and good job.

I would love to see an 1.0.0 version soon ^_^

-------

Edit:

Ooopps, another one:

In the Photos module, I don't have access to modify the text of a photo after inserted.

I can only delete and upload it again to have access to change the text.

Could it be added to each photo a small html textarea?

I'm thinking about an explanation of the picture (like a catalog of products with description, sell price, etc)

And what about selecting in the administration if comments ARE allowed (where posible, not moderated) like in photo galleries.

And... OMG! I have just realized that it doesn't have a SEARCH BUTTON!!!

*_*

[eluser]Phil Sturgeon[/eluser]
WOW OMG EVERYTHING IS RIDICULOUS!

I'm always happy to have feedback but please make it constructive and leave out the "nonsense" comments. Myself (and recently several others) work our balls off on PyroCMS for little-to-no credit and barely any money. Feel free to post some "Feature Requests" on our forums so they can be discussed and planned.




Theme © iAndrew 2016 - Forum software by © MyBB