How do I add a link to another php template?

Hi I have created multiple templates, how do I get from one to another… I have tried adding:

<a href="/page2">Page 2</a>

However, this does not work it just takes me to a css file (page2.css) which is in the root folder.

You don’t go from template to template, but from page to page. And a link to a page is created by passing the page url to the href attribute

<a href="<?php echo page('somepage')->url() ?>">Page 2</a>

without a check if a page exists, this code is prone to failure though, if the page gets renamed or deleted.

Having said that, apart from certain special pages (like contact or imprint), you would usually not hardcode these in your templates.

The answer is you cannot have a css file with the same name as the template.

Those two things are completely unrelated. It doesn’t matter what you call your CSS files.

well, once i changed the name of the css file, the error no longer occurred. So I disagree with your statement. If anyone else has a similar problem, they should try the same.

Well, you are free to disagree. It is nevertheless true. Unless you have an unusual folder setup. And as I said, your way of creating those links is not really recommended.

If anyone else ever comes across this: Your CSS files should not conflict with your page links and if that is ever the case, then lets find out why this happens. Page links and CSS links are in no way related, and it can’t be a solution to rename your CSS files.

How can you argue with me about this, if it worked, it worked. Simple.

I just don’t understand how some ppl are coming here to ask for help (which btw is completely for free) without a 'thanks’ and not even being able to take some advise, but rather show a passive-aggressive attitude.