Roych

menu not clickable - redirect help

Recommended Posts

Hello

I need some help with redirecting. I have create a template called (redirect) and AssistedURL field called (redirect_link) for redirecting a page if necessary.

In template I've added:

<?php if($page->redirect_link) $session->redirect($page->redirect_link); ?>

redirect is working, but is it possible to create a link non clickable also, maybe with placing # for link? If I place # now it gives the whole link of the site with /# at the end and gives blank page. So placing (#) would disable a link totaly or something.

Hope u understand what I mean

Thank you

R

Share this post


Link to post
Share on other sites
14 minutes ago, rick said:

Here is a good read.

Thank you for answer, but not really sure how could this help me ;) It's just sometimes the parent menu need's to be unclickable but not sure how to do that from my code above as I'm not a coder, so any help is appreciated.

Thank you

R

Share this post


Link to post
Share on other sites

Hi @Roych,

I'm not quite sure I understand. When you say you have a field for redirecting if necessary, what does necessary mean? And a non-clickable link is just text. Can you expand your requirements further so I understand exactly what you are trying to accomplish please? Maybe a screen shot of a similar interface?

Share this post


Link to post
Share on other sites

It is for main menu and sometimes a link in main menu has to be redirected to external link or non clickable. Sometimes parrent menu has to be non clickable but childrens normal. So the code above is working great for internal and external redirecting (linking) all I need is the posibillity to make it non cliickable also, so maybe with # or something.

So for that kind of page I would give it a redirect template and just enter the url or #.

Don't have any screenshot of something similar :( Hope u understand ...

 

 

Share this post


Link to post
Share on other sites

Im using MarkupSimpleNavigation. I was hoping that there is some if-else possibility with my upper code, so when # is pasted then the link is disabled. Not a coder, that is why I asked here.

Thank you

R

Share this post


Link to post
Share on other sites

Don't worry about whether you are a coder or not. This community is full of people that are glad to help you with whatever issues you may have. We just need more information to do so. Post the code you have to work with and someone here will be along shortly to help you get it sorted.

Share this post


Link to post
Share on other sites

if you have a little courage (and if anyone else is interested), I can write you a little tutorial but you must put your hands dirty 😁, let me know.

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, flydev said:

if you have a little courage (and if anyone else is interested), I can write you a little tutorial but you must put your hands dirty 😁, let me know.

Sure, what do you have in mind?

R

Share this post


Link to post
Share on other sites

You will end up with a PHP function (written by @mindplay.dk) ,two templates and pages which will define your menu. I will write the tutorial a bit later in the afternoon.

  • Like 2

Share this post


Link to post
Share on other sites
On 13. 1. 2018 at 1:02 PM, flydev said:

You will end up with a PHP function (written by @mindplay.dk) ,two templates and pages which will define your menu. I will write the tutorial a bit later in the afternoon.

I know you are probably very busy but still. ;) Any update on this maybe?

Thank you ;)

R

Share this post


Link to post
Share on other sites

Sorry, I totally missed it !   Will try to find the time asap ;)

  • Like 3

Share this post


Link to post
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


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By suntrop
      Sometimes I need pages in the site tree that are basically just a reference to another page – to redirect to the original page or display the same content under the new page url.
      I was surprised I couldn't find anything like that in the forum or as a module already. However, there is a new module by @Robin S but not exactly what I need.
      Example
      Home News Press Newsroom Media Services About Newsroom (virtual page for /news/newsroom/) Contact Example I: The page /about/newsroom/ should act as /news/newsroom/ – so, wehen I loop all pages for a sitemap both pages should have the URL /news/newsroom/.
      Example II: Another example (not often used) would be tu display the exact same content on /about/newsroom/ – although the page itself has no content on its own.
      Those examples don't have much in common, but they are just virtual or fake pages in the site tree.
      While the second one should be an easy task with wireRenderFile(), the first example isn't quite obvious to me. I think I have to use hooks and I have no idea where to start. I really appreciate you guys come up with a solution for everything, but I need to learn this myself  So just some hints to start would be great!
      Do I put the code into a module or some of the _init.php, ready.php etc. files? Or do I have to use a template file (e.g. virtual-page.php)? When I look into Captain Hook  – how do I find the appropriate point to hook into? (/wire/core/ Page.php and loaded()?) Do I need to create/manipulate each field separately (path, title, summary)? Sorry for the long read
       
    • By Peter Knight
      I have a single Processwire install with two domains pointing to it.
      There's
      in-progress.com which is the "proper domain" and won't be live for a few months mini-project.com which needs to go live immediately but just point to a sub-page Is there a way with .htaccess to know when the site is being accessed through mini-project.com, keep that address is the browser bar and redirect to mini-project.com/project-home/
      To give a little context, a part of the in-progress needs to be accessible immediately and we've registered that temporary mini-project.com and pointed it at the same site.
      The key here is to only do that redirect when mini-project.com is the source request. Otherwise I guess I'd use Jumplinks etc
       
       
    • By Marc
      I am trying to make a simple wiredata module that lets me select a page I want all visitors to be redirected to. I have this working in ready.php but then I decided on putting it in a module and I can't get it to work. Here's the relevant bits:
      public function ready() { $this->addHookBefore('Page::render', $this, 'redirectUsers'); } public function redirectUsers(HookEvent $e) { $page = $e->object; // The page we want to redirect to. $redirect = $e->pages->get($this->redirectPage); if ($page->id == $redirect->id) return; // Prevent infinite loop. if (!$e->user->isLoggedin()) { $e->session->redirect($redirect, false); // 'false' indicates 302 temp redirect. } } I left some checks out for simplification. Whenever I'm not on the page that I want to redirect to, an infinite redirect loop starts. Could anybody explain why that is?
    • By mr-fan
      Like title says i've some domains with umlauts öäüß and i'd like to redirect them to the non umlaut version
      example:
      http://my-domän.de to http://my-domaein.de
      i've somethings like this in my htacess:
      ##redirect umlautdomain (not my domain) RewriteCond %{HTTP_HOST} ^xn--mhldorf-nsb.d$ [NC] RewriteRule ^(.*)$ http://muehldorf.de//$1 [R=301,L] in my config.php i only have muehldorf.de in my hosts list...
      is there something that i've misunderstood? so far it doesn't work....but may the htaccess rules take some time to exicute...i tried since about an hour some different rules.
      regards mr-fan
    • By louisstephens
      I hope this is the correct place to post this. I currently am building a "dashboard" that displays some stats etc, but also handles login/logout with a form. Currently, when a user uses the form on the homepage, they redirected (if the credentials are correct) to the backend of processwire.
      However, I was hoping to direct the user back to the dashboard and display an alert (for now until I get a library to handle this). I got it somewhat working if I dont redirect the user. However, if I refresh the page, the alert still "pops up". Does anyone know of a way to redirect to the home page, but then display an alert?
      My Code to login:
      <?php if($input->post->user && $input->post->pass) { $user = $sanitizer->username($input->post->user); $pass = $input->post->pass; if($session->login($user, $pass)) { // login successful $session->redirect($dash); } } ?>