Jump to content

Foundation template problem in top nav bar


allanb
 Share

Recommended Posts

Hi 

I have just started with PW and after struggling to get a test site on my hosting platform.

PHP 5.2.17 mysql 5.0.96.

Problem with .htaccess and follow symbolic links which I have sorted out (commented out)

Default page and admin loaded OK.

I then uploaded Foundation files flushed site (?flush=1)

Problem can be see at http://new.stpiusx.za.org/

Same problem in Chrome & Firefox

I have done similar installation on local server (PHP 5.3.10 mysql 5.5.32) all worked OK

Any thoughts would be appreciated not sure were to look?

System seems very fast

Allan

Link to comment
Share on other sites

Hi allanb,

Welcome to PW! I have had a quick look. Your ul.right seems to have a height of 345px. Did you change the default styles that come with the profile? It is definitely a CSS issue. I think that height is being inherited from somewhere...

Btw, in your html source I am seeing 6 PHP notices (undefined variables...). You did not leave your debug on, did you? If yes, you need to turn that off on this live site.

Edited by kongondo
Link to comment
Share on other sites

allanb,
 
I have found what the problem is...you have lots of undefined variable notices and these are nested in <br> tags; those are pushing your menu down...

<b>Notice</b>:  Undefined variable: onlyViewable in <b>/your/server/path/new/wire/core/Page.php</b> on line <b>807</b><br>
<br>                                                   /your/server/path/
<b>Notice</b>:  Undefined variable: onlyViewable in <b>/your/server/path/new/wire/core/Page.php</b> on line <b>807</b><br>
<br>                                                   /your/server/path/
<b>Notice</b>:  Undefined variable: onlyViewable in <b>/your/server/path/new/wire/core/Page.php</b> on line <b>807</b><br>
<br>                                                   /your/server/path/
<b>Notice</b>:  Undefined variable: onlyViewable in <b>/your/server/path/new/wire/core/Page.php</b> on line <b>807</b><br>
<br>                                                   /your/server/path/
<b>Notice</b>:  Undefined variable: onlyViewable in <b>/your/server/path/new/wire/core/Page.php</b> on line <b>807</b><br>
<br>                                                   /your/server/path/
<b>Notice</b>:  Undefined variable: onlyViewable in <b>/your/server/path/new/wire/core/Page.php</b> on line <b>807</b><br>

I have a feeling your didn't copy all of your files over...

Link to comment
Share on other sites

In those notices, PW is complaining about line #807 in /wire/core/Page.php/

public function numChildren($onlyVisible = false) {
   if(!$onlyViewable) return $this->settings['numChildren'];
   return $this->children('limit=2')->getTotal();
}
Link to comment
Share on other sites

I think you are on point adrian. I think I noticed there was a difference between versions but was still doing comparisons...

Edit:

Was grepping dev version instead of foundation version. Anyway, dev has similar function in PageTraversal.php and uses onlyVisible

public function numChildren(Page $page, $selector = null) {
	if(is_bool($selector)) {
		// onlyVisible takes the place of selector
		$onlyVisible = $selector; 
		if(!$onlyVisible) return $page->get('numChildren');
		return $page->children('limit=2')->getTotal();
Edited by kongondo
Link to comment
Share on other sites

Hi All

I am impressed at the speed of responce on Saturday night.

I had debug set to true as @kongondo suggested.

Set to false and page now renders correctly.

I still think there may be a problem in the code???

I am on PHP 5.2.17 not 5.2.1.7 as reported by host on C panel and info.php.

I can not find any reference to mod_rewrite in info.php but your install page said rewrite through cgi.

Thank you all

Allan

Link to comment
Share on other sites

Hi all

1.

I have also found that if you go to 150% zoom menu changes to phone type and processwire logo moves to the left outside of rest of page.

Could be because of error above??? Not qualified enough to know as yet!

2.

I am also unable to find how to change or delete content between image slider and footer.

Could anyone help please?

I am most impressed with this template. 

Regards

Allan

Link to comment
Share on other sites

Hi Allan,

In future, please post questions related to the Foundation Profile in its forum support thread here: http://processwire.com/talk/topic/4014-zurb-foundation-4-site-profile/ Make's it easier for the developer to pick them up plus keeps everything related together :)

Qn#2: That seems to be coming from these code in basic-page.php and home.php templates files which are calling the function renderBodyNav  (see this) in _nav.php

$body .= renderOrbit($page->images) . renderBodyNav($page->children);//home.php
if($page->numChildren(true)) $body .= renderBodyNav($page->children); //basic-page.php

How comfortable are you with PW and PHP? I'm just wondering if the code in this profile may be a bit advanced for you at the moment?

Link to comment
Share on other sites

hi kongondo

Could someone move this post to forum support thread?

2.

I am also unable to find how to change or delete content between image slider and footer.

Could anyone help please?

 

I have checked basic-page.php, home.php, _main.php and _init.php I did not check _nav.php as I assumed this was for the navigation.

 

I have only been working with PW for 2days and by no means an expert in PHP though am able to read and understand basics.

 

Allan

Link to comment
Share on other sites

Allan,
 
When on the homepage, you are talking about the highlighted content as in the screenshot below, right?

post-894-0-46024900-1375105688_thumb.png
 
If you look at the HTML source of that page you see this code: 

<ul class="body-nav side-nav">
<li class="divider"></li>
<li><a href="/foundation/about/">About</a> <span class="summary">This is a placeholder page with two child pages to serve as an example. </span> </li>
<li class="divider"></li>
<li><a href="/foundation/templates/">Templates</a> <span class="summary">More about the templates included in this basic site profile. </span> </li>
<li class="divider"></li>
<li><a href="/foundation/site-map/">Site Map</a> <span class="summary">View this template's source for a demonstration of how to create a basic site map. </span> </li>
</ul>

Notice the class in the <ul>? It is "body-nav side-nav". If you look at _nav.php, line #100 you see this code:
 

'class' => 'body-nav side-nav', 

which is part of the function renderBodyNav. That tells me that function is responsible for the <ul>......</ul> code above. So, we search for instances of that function in our template files. This will lead to 3 places (including search.php) but the ones we are interested are on home.php (used by "home" page) and basic-page.php (used by "about" page and others I presume). What the code does is this:
 
In the case of home.php, it looks for the children of "home" and creates a list with links to those pages (and appends them to $body). I haven't thoroughly looked at the code but I believe there would be a limit clause somewhere so you do not get all the children of the home page (they could be many!)

$body .= renderOrbit($page->images) . renderBodyNav($page->children);//home.php

  Change that code to this

$body .= renderOrbit($page->images);//home.php

We have now removed the call to renderBodyNav. I understand, the name can be misleading, but look at this way...the list is just a navigation; a navigation to child pages.
 
In the case of basic-page.php, the code first checks if the page being viewed (in this case pages using basic-page.php as their template file) has children (the $page->numChildren(true)). If it does output the child pages as a list (appending them to $body). If it doesn't, do nothing...
 
If you don't want the list of child pages to appear in pages using basic-page.php (like "about" page, I presume), then change: 

if($page->numChildren(true)) $body .= renderBodyNav($page->children); //basic-page.php

to this; we just comment it out.

//if($page->numChildren(true)) $body .= renderBodyNav($page->children); //basic-page.php

Test this and see how it works. I haven't studied the code in-depth so check if there are consequences in output that comes after that list...
 
I suggest that you read up on PW, specifically these documents:
http://processwire.com/api/selectors/
http://processwire.com/api/variables/page/
http://processwire.com/api/variables/pages/
 
Also, check out the PW wiki and go through the tutorials. 
 
This way, your experience with PW will be much richer and you will be amazed at how quickly you can build things with the system. I am not suggesting that you should not ask questions. I am saying if you understand the system, you will have much more fun and satisfaction when you look back at what you've accomplished and there will be less hair pulling ;) (your hair, not mine, hehe)

Link to comment
Share on other sites

Hi kongondo

Thanks for your detailed explanation I will follow your ideas and also do a bit more reading as you pointed out.

One point I do not understand from your explanation home page has no children and about page which uses template basic-page has only 2 children yet output only on home page of 3 <li> + 3 <li> dividers as you showed in HTML source.

Also unable to find the HTML output in any of the files.

Allan

Link to comment
Share on other sites

Allan,

If home page had no children your website would have only 1 page; home :) In PW, all pages are children of Home. So, home has children. This is even evident when looking at the site map page..."about", "site map" and "templates" are all children of home. I can see the same thing in your test page meaning you haven't changed much. Even if you had, yes, all those other pages (if you had them) would still be children of home :D

Remember, the renderBodyNav($page->children) code is specific to the page being viewed. Page always refers to the current page. So:

  • When viewing home page, you see links to its 3 children (about, site map and templates) + the "orbit images", i.e.,  renderOrbit($page->images
  • When viewing about page on your site, you see links to its 2 children (Child page example 1 and Child page example 2) and 3 children (in the PW default install with Foundation example - Child page example 1, Child page example 2 and Typography Tests)

As for HTML code in the template files (/site/templates/), these are mostly in _main.php, I believe. Create a local (WAMP/XAMPP, etc) test install of PW using Foundation profile (although I'd suggest you start with the default profile). In /site/config.php, turn debug on (true). Then,  I suggest to go through each and every template file used (minus admin.php). There's only 7 of them. That way, you'll see and study what's going on behind the scenes, follow the code to see where the rabbit-hole leads. Test things. What function calls what? What file is included? Comment and uncomment the code to see what breaks and happens, even deliberately throw in silly undefined variables in the works. What breaks? What error does PW through? Of course this will be a test environment and you can always undo. Write notes along the way (even better as your personal comments within the code itself). Additionally, you can use the trick I showed you above.  Look at the HTML source and use things like "id=xyz" and class="abc" as terms to search/grep through the template files in /site/templates to find out where the HTML is coming from.

Link to comment
Share on other sites

Thanks again kongondo

I did not see home as having children. My mistake did not see indentation or did'nt want too.

Now makes some sense.

I have a local LAMP server LINUX  that I used for first install of PW all went well no problems.

As the first site I wanted to try needed to be highly responsive for mainly younger people who live by cell/mobile phones that was why I installed the Foundation Profile.

I had a foundation template working on MODX but unable to get it working on my host would have to use earlier version (not good idea security wise)

Saw you post on MODX and remembered you from WAYFINDER Tutorial(bible) and decided to give it a try.

I  think it seems easier to me but maybe MODX taught me a lot.

I am more of a programmer than a designer.

Allan

Link to comment
Share on other sites

MODX did teach me a lot too. With PW I have learnt even more and am steadily moving from designer to semi-developer if there's such a thing :D PW has encouraged (not forced) me to move in this direction and the journey so far has been thoroughly enjoyable. It's so refreshing to type code, throw in some logic here and there and to see the results displayed! Anyway, I digress. You've made the right choice to start using PW. Enjoy!

  • Like 1
Link to comment
Share on other sites

In those notices, PW is complaining about line #807 in /wire/core/Page.php/



public function numChildren($onlyVisible = false) {
   if(!$onlyViewable) return $this->settings['numChildren'];
   return $this->children('limit=2')->getTotal();
}
 

I changed in line #807 in /wire/core/Page.php/

if(!$onlyViewable) return $this->settings['numChildren'];

to

if(!$onlyVisible) return $this->settings['numChildren'];

as suggested by @adrian

and this solved the problem of

allanb,

I have found what the problem is...you have lots of undefined variable notices and these are nested in <br> tags; those are pushing your menu down...

<b>Notice</b>:  Undefined variable: onlyViewable in <b>/your/server/path/new/wire/core/Page.php</b> on line <b>807</b><br>
<br>                                                   /your/server/path/
<b>Notice</b>:  Undefined variable: onlyViewable in <b>/your/server/path/new/wire/core/Page.php</b> on line <b>807</b><br>
<br>                                                   /your/server/path/
<b>Notice</b>:  Undefined variable: onlyViewable in <b>/your/server/path/new/wire/core/Page.php</b> on line <b>807</b><br>
<br>                                                   /your/server/path/
<b>Notice</b>:  Undefined variable: onlyViewable in <b>/your/server/path/new/wire/core/Page.php</b> on line <b>807</b><br>
<br>                                                   /your/server/path/
<b>Notice</b>:  Undefined variable: onlyViewable in <b>/your/server/path/new/wire/core/Page.php</b> on line <b>807</b><br>
<br>                                                   /your/server/path/
<b>Notice</b>:  Undefined variable: onlyViewable in <b>/your/server/path/new/wire/core/Page.php</b> on line <b>807</b><br>

I have a feeling your didn't copy all of your files over...

Although this solves the problem of the errors.

There is still a problem with the template when viewed @ 150% zoom

The site logo is to the left of the page.

The menu changes to mobile ie icon.

The timing bar in the slider moves outside of the image to the right.

I will see what I can find but I feel this is way above my paygrade at present.

Also not sure if I should PM @ryan to inform him of problem.

Also moving this post to a more suitable place as suggested by @kongondo.

Allan

Link to comment
Share on other sites

Hi again kongondo

I do have Github account I will file there and get into process. got to start to be helpful sometime.

I will also PM Ryan.

Thanks for all your involvement.

Will mark as solved

Allan

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

×
×
  • Create New...