The following warnings occurred:
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message



GetSimple Support Forum
component only in child pages - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: component only in child pages (/showthread.php?tid=8092)



component only in child pages - Timbow - 2016-03-04

I have a site with two levels of navigation, so just parents and children. I want to insert a component at the bottom of all the child pages only, not the parents.

What's the conditional php I put in my template for that?


RE: component only in child pages - Bigin - 2016-03-04

Hmm... There are numerous ways to do it.
You can identify the target page by slug for example:

Code:
if(get_page_slug(false) == 'ma_slug') {
    // show component ...
}

Or, simply check if the current page has a specific parent then show your component:

Code:
$parent = get_parent(false);
if(!empty($parent) && $parent == 'page_parents_slug') {
    // show component ...
}

Or generally, when the same rules apply to all child pages on entire template, you can see whether page has parent then show your component:

Code:
if(!empty(get_parent(false))) {
    // show component ...
}



RE: component only in child pages - Timbow - 2016-03-05

(2016-03-04, 16:04:43)Bigin Wrote: ...Or generally, when the same rules apply to all child pages on entire template, you can see whether page has parent then show your component:

Code:
if(!empty(get_parent(false))) {
    // show component ...
}

It's that last one I need, thanks but it is giving me -
Fatal error: Can't use function return value in write context in /var/sites...



Just to be clear I have 
PHP Code:
<?php if(!empty(get_parent(false))) { get_component('tagline')}; ?>



RE: component only in child pages - Bigin - 2016-03-05

try this, that should do the trick:
Code:
$parent = get_parent(false);
if(!empty($parent)) {
    // show component ...
}



RE: component only in child pages - Timbow - 2016-03-05

(2016-03-05, 03:28:23)Bigin Wrote: try this, that should do the trick:

Code:
$parent = get_parent(false);
if(!empty($parent)) {
   // show component ...
}

For some reason I get the component on all pages with that. I can check the variable is empty with print $parent (and it is). Using
PHP Code:
<?php $parent get_parent(false);
if(!empty(
$parent)) {get_component('disqus');} ?>



RE: component only in child pages - Bigin - 2016-03-05

(2016-03-05, 07:19:34)Timbow Wrote: For some reason I get the component on all pages with that. I can check the variable is empty with print $parent (and it is). Using

Because $parent is of type object, you should cast it to a string:

Code:
$parent = (string) get_parent(false);
if(!empty($parent)) {
    ...
}



RE: component only in child pages - Timbow - 2016-03-05

Yes!


All working. Smashing. Thanks, mate.