Welcome Guest, Not a member yet? Register   Sign In
PyroCMS v0.9.7.4 - an open-source modular general purpose CMS

[eluser]fatdog[/eluser]
5.) Yes, I use this hosting account as a test server, so there is at least one other site using CI.

6.) About this spanish/language issues. I suggest that the installer should let me check if I want the site to be multilingual or not, or to let me check if I want to make one language as default regardless of users location, browser, etc.

8.) Dude! I did all the chmodding necessary as the install file says. I'll recheck those permissions.

11.) That explains why I couldn't see a sidebar. :-S

Now stop wasting time posting on forums and go and make a full feautured self explanatory bugless version of PyroCMS. You can call it... PyroCMS 1.0 :coolsmirk:

[eluser]Yorick Peterse[/eluser]
The dummy data error should only pop up whenever the tables don't exist. The installer has been updated earlier today and will now show which files should have their permissions changed.

Quote:I expect there should be a “succesfull installation” page with the admin data, etc.

The installer will show a notification if you have succesfully installed the database, you can't miss it.

Quote:10.) Yeah thats not done yet. It shouldnt have been commited to master if it wasnt finished… Yorick!

Will be finished once the widgets system is working Wink

[eluser]Phil Sturgeon[/eluser]
[quote author="fatdog" date="1250879662"]Now stop wasting time posting on forums and go and make a full feautured self explanatory bugless version of PyroCMS. You can call it... PyroCMS 1.0 :coolsmirk:[/quote]

OK, I will stop posting support and planning features based on community suggestions and feedback. Who needs any of that stuff anyway! :coolhmm:

[eluser]Yorick Peterse[/eluser]
[quote author="Phil Sturgeon" date="1250894776"][quote author="fatdog" date="1250879662"]Now stop wasting time posting on forums and go and make a full feautured self explanatory bugless version of PyroCMS. You can call it... PyroCMS 1.0 :coolsmirk:[/quote]

OK, I will stop posting support and planning features based on community suggestions and feedback. Who needs any of that stuff anyway! :coolhmm:[/quote]

Indeed, prevent any communication at all! Confusednake:

[eluser]Turv[/eluser]
Just a quickie, The pages module...You can select a parent page, So you could have a strucutre such as

About Us (URL: /about-us/)
- The Company (URL: /company/)
- The Staff (URL: /staff/)

I'm not familiar with Matchboxes routing, How could we make it so that if a page has a Parent page, then they have to enter the url like domain.com/parent-page/child-page/

So the above urls would look like
domain.com/about-us/
- domain.com/about-us/company/
- domain.com/about-us/staff/

This is kind of am important feature for Search Engine Optimisation purposes.

I think something could be modified in the _validate_request() Function in the overridden CI Router to say...If theres multiple segments then send the last segment to the pages module, otherwise send the first?

Not sure if i'm heading in the right direction.

[eluser]Phil Sturgeon[/eluser]
This is a very important feature but something I could not get my head around either.

I got that code working fine, where it sends the last segment through if there are multiple, BUT if you do that then there are a few problems.

/about-us/details
/stuff/details

Both of these pages have the same URL identifier which is 'details'. Right now this is a problem. Should it be?

And I dont like the idea of linking to URL ref's within pages, as that could change at any point. Some systems link to ID's and dynamically build the link to it, or use an automatic remap listing that adds redirects to URL's when they change.

I kinda think the whole page manager needs to be thrown out and started again, or at least heavily overhauled.

[eluser]Turv[/eluser]
Right, I've got it working but i don't know how...reliable it is, Could you have a look and see what you think?

Page Controller, Remap Function
Change: If there is a second segment, add to Slug array and then call 'call_user_func_array', Passing the sub page to the Pages function.

Code:
function _remap()
    {
        // If Sub page exsits
        if($this->uri->segment(2))
            $slug = Array($this->uri->segment(1, 'home'), $this->uri->segment(2));
        else
            $slug = $this->uri->segment(1, 'home');
            
        // This basically keeps links to /home always pointing to the actual homepage even when the default_controller is changed
        @include(APPPATH.'/config/routes.php'); // simple hack to get the default_controller, could find another way.
        
        // The default route is set to a different module than pages. Send them to there if they come looking for the homepage
        if(!empty($route) && $slug == 'home' && $route['default_controller'] != 'pages')
        {
            redirect('');
        }
        
        // Default route = pages
        else
        {
            // Show the requested page with all segments available
            call_user_func_array(array($this, 'page'), $slug);
        }
    }

Page Controller, Page function
Change: Added $sub pararmeter, If Sub page exists call the getBySlug model function with the sub page as an additional parameter

Code:
function page($pri = 'home', $sub = '')
    {
        // If the user has a Sub Page...
        if($sub != '') {
            if(!$page = $this->cache->model('pages_m', 'getBySlug', array($pri, CURRENT_LANGUAGE, $sub)) )
                show_404();
        } else {
            if(!$page = $this->cache->model('pages_m', 'getBySlug', array($pri, CURRENT_LANGUAGE)) )
                show_404();
        }
        
        // Parse any settings, links or url tags
        $this->load->library('parser');
        $page->body = $this->parser->string_parse($page->body);
        
        // Not got a meta title? Use slogan for homepage or the normal page title for other pages
        if($page->meta_title == '')
        {
            $page->meta_title = $pri == 'home' ? $this->settings->item('site_slogan') : $page->title;
        }
        
        // Define data elements
        $this->data->page =& $page;
        
            // If the GET variable isbasic exists, do not use a wrapper
        if($this->input->get('_is_basic'))
        {
            $this->layout->wrapper(FALSE);
        }

        else
        {
            $this->layout->wrapper('layouts/'.$page->layout_file);
        }
        
        // Create page output
        $this->layout->title( $page->meta_title )
        
            ->set_metadata('keywords', $page->meta_keywords)
            ->set_metadata('description', $page->meta_description)
            
            ->create('index', $this->data);
    }

Pages Model, getBySlug function
Change: Added additional Sub Page Parameter, If sub page exists then get the PageID (New Function getIdBySlug()). I then add an additional where clause so that it will find the page where the slug is equal to whatever AND the Page's Parent is equal to the primary slug.

Concluding - that means you can have page/details and other-page/details because it will find the page where the parent id is set. If anything fails it will return a 404 which should be correct.

Code:
public function getBySlug($slug = '', $lang = NULL, $sub = null)
    {
        if($sub != null) {
            // If Has sub page, Only accept if Parent ID is equal to primary slug
            $SlugID = $this->getIdBySlug($slug);
            $this->db->where('slug', $sub);
            $this->db->where('parent', $SlugID);
        } else {
            $this->db->where('slug', $slug);
        }
        
        if($lang == 'all')
        {
            exit('where did this code go?! tell me if you see this message [email protected]!');
        }  
            
        elseif($lang != NULL)
        {
            $this->db->where('lang', $lang);
        }
        
        return $this->get($lang);
    }

New function in pages model

Code:
public function getIdBySlug($slug = null) {
        if($slug == null)
            return false;
        
        $this->db->where('slug', $slug);
        $Query = $this->db->get('pages')->row_array();
        
        // Return ID
        return $Query['id'];
    }

Have a look and see what you think, I think it should work fine but can you see any problems with the code above?

[eluser]Phil Sturgeon[/eluser]
This would need to be an array:

Code:
$slug = $this->uri->segment(1, 'home');
// becomes
$slug = array( $this->uri->segment(1, 'home') );

A larger issue is that this is not very dynamic. What happens when somebody creates a child of a "sub-page"?

It may require a different approach. I was considering this one:

When you select a "parent page" it puts "/parent-slug/" before the input box and into a hidden field, then stores it all as part of the slug" so the new child slug would be "/parent-slug/new-page"?

I am not 100% on the approach (which is why I have no done it) and I don't even know if I'm just overcomplicating things.

[eluser]Turv[/eluser]
I see what you mean now.

What would need to be done is get all the URI Segments into an Array, Pass this Array to the getBySlug function, and then have a recursive loop to check the parent id's of the previous segments.

Using your method, how would it work, Would you get the URI as a string such as /parent/child/ and then compare the URI String to the slug stored in the database which assumingly would also be /parent/child/ ?

[eluser]Phil Sturgeon[/eluser]
Possibly, not sure. This issue is one of about 5 large issues giving me a serious brain-fart.




Theme © iAndrew 2016 - Forum software by © MyBB