Jump to content

Custom link for view button in admin/edit mode possible?


simonGG
 Share

Recommended Posts

Hi there,

i developt a single page website where home.php includes the template file php's.
So my template files are not considered to be viewed as they are. Only in context 
with the home. Because of that i want that the view button in edit mode allways
links to the root page. Is this possible?

Thanks in advance && regards
Simon

Link to comment
Share on other sites

A simple session->redirect($pages->get(1)); exit(); won't do in your template files?

Edit: you would probably need to wrap the redirect into a condition $page->id != 1 to allow your template code run on the homepage.

Link to comment
Share on other sites

On 10/22/2016 at 7:43 AM, tpr said:

A simple session->redirect($pages->get(1)); exit(); won't do in your template files?

Edit: you would probably need to wrap the redirect into a condition $page->id != 1 to allow your template code run on the homepage.

Shouldn't 

return $this->halt();

be used instead of

exit();

?

  • Like 1
Link to comment
Share on other sites

26 minutes ago, tpr said:

but without "return" (there is no function context)

You're correct, that there's no function context, but a return statement does also stop the execution of code in files loaded by require/include statements. Most often a $this->halt() without return doesn't make much sense.

  • Like 2
Link to comment
Share on other sites

Sorry for the late replay - and thanks for your help.
I ended up with this in all template files - it's a multilingual Site ():

$pages = wire('pages');
$session->redirect($pages->get(1)->url);
exit();

Without get(1)->url it redirected me to ...myurl/de/pageName/1 - maybe this has to do with the fact that ist is a multilingual site?

Thanks a lot + regards
Simon

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...