Forum

Thread tagged as: Question, Problem

Navigation / cruftless links

I am pretty new to Perch dev and enjoying the simplicity. However I have a little problem with a site navigation.

I have not used perch pages before. My problem is:

Home page is index.php about page is in a sub folder /about-us/index.php All other pages are treated the same

When I use perch navigation I get

<ul>
    <li><a href="/sitedev/">Home</a>            
            <ul>
        <li><a href="/sitedev/about-us/">About us</a></li>
            <li><a href="/sitedev/client/">Client Services</a></li>
        <li><a href="/sitedev/register/">Candidate Services</a></li>
        <li><a href="/sitedev/contact-us/">Contact us</a></li>
        <li><a href="/sitedev/register-form/">Register With Us</a></li>
            </ul>
        </li>
    </ul>

So all my pages are treated as subpages of Home...

I've created the basic website like this so that I don't get url's like "about-us.php'

Are there any recommended solutions for creating pages in this way an dave the navigation auto created?

my development site is at: https://renfieldsearch.com/sitedev/

Thanks advance Steve

Steve Counsell

Steve Counsell 0 points

  • 6 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

The main problem is that you are developing in a subfolder. You should point a subdomain at your site so that you do not change root when you go live, that's likely to cause you problems.

Thanks for the pointer Rachel.

The client does not have access to subdomains. What are the issues I'll face moving the site up to the domain root? I assumed that I'd just change the config.php login path ...

FROM - define('PERCH_LOGINPATH', '/sitedev/admin'); TO - define('PERCH_LOGINPATH', '/admin');

Is that not correct?

What about the URLs without .php; is the subfolder for every page causing the navigation problem? How do other people develop that?

Thanks in advance Steve

Drew McLellan

Drew McLellan 2638 points
Perch Support

When you move all your pages up a level, you'll need to go into each's page's options and remove the sitedev portion of the path.

Thanks Drew :)

I've been battling with the sub directory issue too. I hate to be negative because I really like Perch so far, but this is appalling configuration. Wordpress has always suffered from migration/navigation issues but I was expecting Perch to be much more configurable. Insisting on the site being in the domain root and subdomain development is terribly short sighted and limiting. I'm very disappointed.

Developing in a subfolder is bad practice and will always break if you change setup when going live.

The purpose of developing locally is to set up your environment exactly how it's going to be when the project is live.

Perch is not at fault

I'm not trying to flame. Apologies, this is isn't really the place to discuss Perch's architecture. But developing in a subfolder is not "bad practice" at all, there is no reason a site can not be easily portable—besides what if I want a Perch controlled site running off an existing site controlled by some other system—it's a use case not bad practice.

The Perch config has constants such as 'PERCH_SITEPATH' which I was expecting to define the base path of the site. Unfortunately, doesn't seem to be the case.

Sorry for speaking bad of Perch—as I said I really like most of it's features, I just find myself disappointed by this element of hardcoded assumption.

Richard Standbrook said:

I'm not trying to flame. Apologies, this is isn't really the place to discuss Perch's architecture. But developing in a subfolder is not "bad practice" at all, there is no reason a site can not be easily portable—besides what if I want a Perch controlled site running off an existing site controlled by some other system—it's a use case not bad practice.

The Perch config has constants such as 'PERCH_SITEPATH' which I was expecting to define the base path of the site. Unfortunately, doesn't seem to be the case.

Sorry for speaking bad of Perch—as I said I really like most of it's features, I just find myself disappointed by this element of hardcoded assumption.

I agree Richard!

I've worked as an IT project manager running, among other things, software dev for over 25 years. I'd see this as a lack of use case development.

Bad practice? No Way!

I'm a customer of Perch and a user so I MUST be right :)

I develop in a sub folder on the main web server and then move sites to live. It's a serious pain to have to comply with Perch's view of how everyone should develop.

Luckily I usually only develop small sites with 5 or so pages so it's easy for me to add the content back in once I've moved the site up a folder.

I'm coming from a Wordpress dev environment. Wordpress works fine in these circumstances so I don't see a reason that Perch could not. It'll just take some adjustment to how the "site address" is handled in the system.

Drew McLellan

Drew McLellan 2638 points
Perch Support

PERCH_SITEPATH was only added with Runway, so it's fairly recent.

Of course Perch could work differently. It's not that I've just never thought of it or want to maliciously inflict pain on your day. Technically it could support any way of working. But every option takes time to implement, time to test, and increases the complexity of the software making it harder to use and slower to develop. So I have to make choices.

All software involves choices - it's those design decisions that make each system interesting and suited to one task or another, one developer or another. You may not agree with every choice, but I do have to make them. I can't not make choices.

Hey Drew, Great response :)

I know it's all about choices so I think you're doing a great job and that Perch is the best CMS I've ever used.

My reply above was really a reaction to the "bad practice" comments from Dexter Harrison...

Thanks again Drew for an excellent product :)

Thank you Steve. I'm glad that isn't the feeling of the entire community.

Thanks Drew, I do appreciate the need for choices, and also how software evolves over time, I am a software developer myself and have had to work with the decisions I've made over the years too.

Hopefully PERCH_SITEPATH will find wider usage as Perch evolves. I would cast my vote that this is something worth doing as it's not an uncommon questions in the forum (based on my recent searches).