Jump to content

how to get a right url ?


adrianmak
 Share

Recommended Posts

My pw is installed under a sub-folder i.e http://localhost/pwtest

i just created a frontend user login page. The url path is

/user/login

in the main template

I have hard-coded a login link

<a href="user/login">Sign in</a>

At the homepage, the login url look good, it will show http://localhost/pwtest/user/login

However when I go to another page say a contact page http://localhost/pwtest/contact

When hover the login link, it changed to http://localhost/pwtest/contact/user/login

and it is not a correct link

Link to comment
Share on other sites

Im using :
 

<a href="<?php echo $pages->get(ID_OF_PAGE)->url; ?>">
   <?php echo $pages->get(ID_OF_PAGE)->title; ?>
</a>

This way i get page that i want, i can change its name and title from inside admin panel. This way i dont have to go in code every time i want change title or parent of the page

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...