Jump to content

Recommended Posts

Posted

Kind of new to the process wire environment. I've tried for hours to figure this out. I want a menu entry (page) that goes to an external site. This seems to be much easier said than done.

I made a field called redirectTo of type URL. I added it to a template I made called redirectPage. In the redirectPage.php, this is what I put:

<?php

$session->redirect( $page->redirectTo->url );

?>

Apparently this isn't good enough, or I'm just doing something wrong. Forgive any ignorance on my part. All it seems to want to do is redirect to itself over and over again, or something. I even tried changing it to something like...

<?php

echo $page->redirectTo->url;

?>

I don't remember if this was the exact thing I tried, but it just returns nothing. Can someone help me here? I was trying to base it off of this, but it just does not work for me: https://processwire.com/talk/topic/341-uri-redirect/

Thanks all.

Posted

In this case you probably just want:

$session->redirect( $page->redirectTo );

because a URL field doesn't have a url property - it's just a string.

  • Like 1
Posted

Holy frick, thank you. That does exactly what I want. I've been fiddling with this crap for hours.

No problem at all. Welcome to the forums btw.

I am sure it will all start to make sense very soon!

  • Like 1

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
  • Recently Browsing   0 members

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