Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2019-02-27 04:39:53

scottfrey
Member
Registered: 2013-10-12
Posts: 122

Custom Menus for mobile using phpplugins not working

I'm trying to implement Daniel's suggestion from this thread: http://community.theturninggate.net/vie … hp?id=9243

post #7:

I would design a dedicated menu-set for mobile that uses a simpler structure. First I would design this alternative menu in Backlight (create a new menu-set for that!), then copy the generated source code that is enclosed by the nav divs:

I've done that, and added the following to my phpplugins;

// mobile navigation
function pallet01_top () {
  echo '
<nav class="nav nav_v">

<div id="page__pallet__T1" class="page__column page__pallet" data-position="T1">
	<div class="content clearfix">


<nav class="nav nav_v">
 

<ul class="primary-menu menu mouseable"><li class="menu-item"><a href="/portfolio/"><b>Portfolios</b></a></li><li class="menu-item"><a href="/collections/">Places</a></li><li class="menu-item"><a href="/events/">Events</a></li><li class="menu-item"><a href="/about/">About</a></li><li class="menu-item"><a href="/backlight/search/">Search</a></li></ul>
 
</nav>

	</div>
</div>

</nav>
  ';

   return true;
} // END /**/

However, I've done something wrong, as I still get the pages' normal navigation.

ALSO:

And then obviously you need to revert your site back to the original menu and disable the mobile menu.

If I disable Vertical navigation (as opposed to pallet1) I no longer get any navigation for mobile (and no hamburger menu button).

Last edited by scottfrey (2019-02-27 04:53:33)

Offline

#2 2019-02-27 05:56:51

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Custom Menus for mobile using phpplugins not working

you've got too many nav divs!
try removing the first

<nav class="nav nav_v">

and the last

</nav>

Then change return true; to return false; that's what removes the normal navigation

If I disable Vertical navigation (as opposed to pallet1) I no longer get any navigation for mobile (and no hamburger menu button).

Then try not disabling it. The phplugins function should replace it.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#3 2019-02-27 06:08:08

scottfrey
Member
Registered: 2013-10-12
Posts: 122

Re: Custom Menus for mobile using phpplugins not working

Thus:

// mobile navigation
function pallet01_top () {
  echo '
<div id="page__pallet__T1" class="page__column page__pallet" data-position="T1">
	<div class="content clearfix">


<nav class="nav nav_v">
 

<ul class="primary-menu menu mouseable"><li class="menu-item"><a href="/portfolio/"><b>Portfolios</b></a></li><li class="menu-item"><a href="/collections/">Places</a></li><li class="menu-item"><a href="/events/">Events</a></li><li class="menu-item"><a href="/about/">About</a></li><li class="menu-item"><a href="/backlight/search/">Search</a></li></ul>
 
</nav>

	</div>
</div>

  ';

   return false;
} // END /**/

Makes no change, same exact behavior.

Then try not disabling it. The phplugins function should replace it.

it does not.

I'm still missing something. How can I tell if phpplugins is actually doing anything at all?

Offline

#4 2019-02-27 06:21:23

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Custom Menus for mobile using phpplugins not working

scottfrey wrote:

I'm still missing something. How can I tell if phpplugins is actually doing anything at all?

function main_top () {
   echo 'hello scott frey';
}

A link to your page could be helpful too.

Do you have a two column layout selected?


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#5 2019-02-27 06:23:23

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Custom Menus for mobile using phpplugins not working

are you starting with the phplugins-pangolin-sample.php file?
Are you leaving in all the existing code at the top (the stuff that makes this work)?

In your page template have you enabled phplugins and chosen the correct file?


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#6 2019-02-27 07:02:56

scottfrey
Member
Registered: 2013-10-12
Posts: 122

Re: Custom Menus for mobile using phpplugins not working

function main_top () {
   echo 'hello scott frey';
}

Perfect test. Yes, it works

A link to your page could be helpful too.

https://www.lightsmithy.com

are you starting with the phplugins-pangolin-sample.php file?
Are you leaving in all the existing code at the top (the stuff that makes this work)?
In your page template have you enabled phplugins and chosen the correct file?

All good questions, and initially I had not, but I figured that part out on my own ;) Yes, to all those. Daniel's sample code is showing on the page. (that might be something to leave uncommented in the sample, like the RED background in the custom CSS sample). PHPlugins is clearly working now with the sample code, but not writing in the menu code

Here is a link to the full phplugins file: https://www.dropbox.com/s/whzw5a7941koo … y.php?dl=0

Offline

#7 2019-02-27 07:40:36

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Custom Menus for mobile using phpplugins not working

Using the navigation() hook, one can replace the menu. But this affects horizontal and mobile menus.


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#8 2019-02-27 07:41:03

scottfrey
Member
Registered: 2013-10-12
Posts: 122

Re: Custom Menus for mobile using phpplugins not working

If I use a two column layout, I have a two column page instead of a nicely centered one column page. That does however, kinda get menu showing.... I get both, overlapping each other.

I don't know if there is a way to force pallet01 to show on mobile only.

The problem is started by there not being a way to force pallet01 to NOT replace Navigation on mobile.

It's frustrating that Matt has given us such a great way to make elegant useable menus on desktop, but if we use them we cripple navigation on mobile (I dare you to try navigating my site on a phone).

Offline

#9 2019-02-27 07:42:20

scottfrey
Member
Registered: 2013-10-12
Posts: 122

Re: Custom Menus for mobile using phpplugins not working

Using the navigation() hook, one can replace the menu. But this affects horizontal and mobile menus

thus defeating the whole point of separate menus (one complex for desktop, one simplified for mobile) wink

Offline

#10 2019-02-27 07:45:31

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Custom Menus for mobile using phpplugins not working

I've got this working. Sort of. It requires a two-column page setup apparently.
And you need to disable Vertical Navigation in the page template (or else you get overlapping menus)

However, with the two column page layout, nothing appears in the pallet when the page is at desktop size. So the layout looks strange. But the menu toggle button does show up when the browser goes to mobile size and the custom menu does appear.

To use this, you can either go with that two column layout with nothing in the pallet at desktop sizes. Or you can add extra content in the pallet01_top hook, like I have: http://backlight-2-100.barbeephoto.com/custom-mobile/

EDIT: Ah, I see you've discovered some of this already.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#11 2019-02-27 07:51:12

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Custom Menus for mobile using phpplugins not working

How about just hiding the sub-menu on mobile?

#page__pallet__T1 ul.sub-menu {
    display: none;
}

Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#12 2019-02-27 07:51:30

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Custom Menus for mobile using phpplugins not working

Well crap. Something even more awkward happens with that pallet content added with phplugins. It gets mixed up with the mobile menu. I'm guessing there's some html structure that needs to be used to avoid this.
Off to probe a normal page....


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#13 2019-02-27 07:55:57

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Custom Menus for mobile using phpplugins not working

rod barbee wrote:

Well crap. Something even more awkward happens with that pallet content added with phplugins. It gets mixed up with the mobile menu. I'm guessing there's some html structure that needs to be used to avoid this.
Off to probe a normal page....

Your code looks strange:

<div id="page__pallet__T1" class="page__column page__pallet" data-position="T1">
	<div class="content clearfix">





<div id="page__pallet__T1" class="page__column page__pallet" data-position="T1">
	<div class="content clearfix">

I don't know why this div is repeated.


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#14 2019-02-27 07:59:41

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Custom Menus for mobile using phpplugins not working

I fixed it. It needed all the pallet structure. This works:

function pallet01_top () {
  echo '
<div id="page__pallet__T1" class="page__column page__pallet" data-position="T1">
	<div class="content clearfix">


		<nav class="nav nav_v">
 

			<ul class="primary-menu menu mouseable"><li class="menu-item"><a href="/portfolio/">Portfolios</a></li><li class="menu-item"><a href="/collections/">Places</a></li><li class="menu-item"><a href="/events/">Events</a></li><li class="menu-item"><a href="/about/">About</a></li><li class="menu-item"><a href="/backlight/search/">Search</a></li></ul>
 
		</nav>


		<div class="widget textwidget">
			<div class ="textwidget">
				<h2>Pallet Content via phplugins</h2>
				<p>This is content added via phplugins to fill this awkward space. Don\'t laugh at me.</p>
			</div>	
		</div>
	</div>
</div>	

  ';

   return false;
} // END /**/

fixed!


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#15 2019-02-27 08:01:58

scottfrey
Member
Registered: 2013-10-12
Posts: 122

Re: Custom Menus for mobile using phpplugins not working

  ';

   return false;
} // END /**/

at teh end I assume...

Offline

#16 2019-02-27 08:03:29

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Custom Menus for mobile using phpplugins not working

yep wink missed that in the copy. I'll fix it smile


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#17 2019-02-27 08:07:21

scottfrey
Member
Registered: 2013-10-12
Posts: 122

Re: Custom Menus for mobile using phpplugins not working

Does not work on mine.

Does not show at all if 1 Column Layout. Does not show at all if vertical nav disabled

Offline

#18 2019-02-27 08:16:39

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Custom Menus for mobile using phpplugins not working

It needs to be a two column layout with vertical nav disabled.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#19 2019-02-27 08:20:55

scottfrey
Member
Registered: 2013-10-12
Posts: 122

Re: Custom Menus for mobile using phpplugins not working

that kinda defeats the point of that big beautiful slideshow then unless I can make the right column really narrow (or 3 column and both narrow)

does the:

Pallet Content via phplugins
This is content added via phplugins to fill this awkward space. Don't laugh at me.

need to be there?

Offline

#20 2019-02-27 08:23:41

scottfrey
Member
Registered: 2013-10-12
Posts: 122

Re: Custom Menus for mobile using phpplugins not working

yeah, that looks terrible and unbalanced in 2 column

Offline

#21 2019-02-27 08:30:29

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Custom Menus for mobile using phpplugins not working

That added content doesn't need to be there. But if it's not, the empty pallet is there, being just an empty, awkward, lonely, pathetic space.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#22 2019-02-27 08:32:34

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Custom Menus for mobile using phpplugins not working

Daniel Leu wrote:

How about just hiding the sub-menu on mobile?

#page__pallet__T1 ul.sub-menu {
    display: none;
}

Ooh. I like that option. As long as you're not using inactive items in the main menu this is a great option.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#23 2019-02-27 09:58:05

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Custom Menus for mobile using phpplugins not working

rod barbee wrote:
Daniel Leu wrote:

How about just hiding the sub-menu on mobile?

#page__pallet__T1 ul.sub-menu {
    display: none;
}

Ooh. I like that option. As long as you're not using inactive items in the main menu this is a great option.

Depending on the hierarchy of the galleries, you could even expose the first sub-level. Check my site, https://danielleu.com/ vs https://danielleu.com/galleries/.


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#24 2019-02-27 10:16:26

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Custom Menus for mobile using phpplugins not working

ah, children.....gotta love em'


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#25 2019-02-27 10:34:29

scottfrey
Member
Registered: 2013-10-12
Posts: 122

Re: Custom Menus for mobile using phpplugins not working

That could be a perfect solution. I'll poke at that tomorrow

That is just a custom CSS call, correct?

Last edited by scottfrey (2019-02-27 10:35:00)

Offline

Board footer

Powered by FluxBB