Jump to content

Search the Community

Showing results for tags '$homepage'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hello PW Community, I'm currently creating a custom profile page that overrides the default template (using user.php file). I noticed however that when I tried to load user.php any calls I have to $homepage broke (my main navigation area). Here is the snippet that doesn't work on user.php, but works everywhere else: <!-- BEGIN SIDEBAR MENU ITEMS--> <ul class="menu-items"> <?php // top navigation consists of homepage and its visible children foreach($homepage->and($homepage->children) as $child) { echo "<li class=''><a href='". ($child->hasChildren() ? "javascript:;" : $child->url) ."'><span class='title'>$child->title</span>"; if($child->hasChildren()) { echo "<span class='arrow'></span></a>"; //loop through the top navigation child's children pages and output them as nested menu item foreach($child->children as $childitem) { echo "<ul class='sub-menu'>"; echo "<li class=''><a href='$childitem->url'>$childitem->title</a>"; echo "</a><span class='icon-thumbnail'>"; echo substr($childitem->title, 0, 2); echo "</span></li></ul>"; } } //step back out and continue listing Homepage Children pages if($child->id == $page->rootParent->id) { echo "</a><span class='bg-success icon-thumbnail'>"; echo substr($child->title, 0, 2); echo "</span></li>"; } else { echo "</a><span class='icon-thumbnail'>"; echo substr($child->title, 0, 2); echo "</span></li>"; } } ?> </ul> <div class="clearfix"></div> </div> <!-- END SIDEBAR MENU --> it outputs a menu and works on all template pages except for user.php. *note that $homepage is defined in _init.php and is loaded before user.php as I left the append to default. Do I have to specifically tell _init.php to append to user.php template? // We refer to our homepage a few times in our site, so we preload a copy // here in a $homepage variable for convenience. $homepage = $pages->get('/'); The error I get is saying the issue is with the first foreach($homepage->and($homepage->children) as $child) line (93), but I thought it would be defined because user.php pulls in _init.php first? Notice: Undefined variable: homepage in /var/www/html/site/templates/user.php on line 93 Fatal error: Uncaught Error: Call to a member function and() on null in /var/www/html/site/templates/user.php:93 Stack trace: #0 /var/www/html/wire/core/TemplateFile.php(268): require() #1 [internal function]: ProcessWire\TemplateFile->___render() #2 /var/www/html/wire/core/Wire.php(374): call_user_func_array(Array, Array) #3 /var/www/html/wire/core/WireHooks.php(549): ProcessWire\Wire->_callMethod('___render', Array) #4 /var/www/html/wire/core/Wire.php(399): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array) #5 /var/www/html/wire/modules/PageRender.module(514): ProcessWire\Wire->__call('render', Array) #6 [internal function]: ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent)) #7 /var/www/html/wire/core/Wire.php(374): call_user_func_array(Array, Array) #8 /var/www/html/wire/core/WireHooks.php(549): ProcessWire\Wire->_callMethod('___renderPage', Array) #9 /var/www/html/wire/core/Wire.php(399): ProcessWire\WireHooks->runHooks(Object(ProcessWire\PageRender), 'renderPage', Arr in /var/www/html/site/templates/user.php on line 93 Error: Uncaught Error: Call to a member function and() on null in /var/www/html/site/templates/user.php:93 Stack trace: #0 /var/www/html/wire/core/TemplateFile.php(268): require() #1 [internal function]: ProcessWire\TemplateFile->___render() #2 /var/www/html/wire/core/Wire.php(374): call_user_func_array(Array, Array) #3 /var/www/html/wire/core/WireHooks.php(549): ProcessWire\Wire->_callMethod('___render', Array) #4 /var/www/html/wire/core/Wire.php(399): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array) #5 /var/www/html/wire/modules/PageRender.module(514): ProcessWire\Wire->__call('render', Array) #6 [internal function]: ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent)) #7 /var/www/html/wire/core/Wire.php(374): call_user_func_array(Array, Array) #8 /var/www/html/wire/core/WireHooks.php(549): ProcessWire\Wire->_callMethod('___renderPage', Array) #9 /var/www/html/wire/core/Wire.php(399): ProcessWire\WireHooks->runHooks(Object(ProcessWire\PageRender), 'renderPage', Arr (line 93 of /var/www/html/site/templates/user.php) This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged. Any insight anyone could provide would be appreciated! Lots to learn when using ProcessWire but it's a solid CMS and I'm really enjoying developing on the platform. Regards, VirtuallyCreative
×
×
  • Create New...