The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
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
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
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
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
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
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
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
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
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
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
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
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
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
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
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
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
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
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot order subpages list, why?
#1
Bug 
Hi. Relatively small problem.

I can not order the subpages i want to echo with the loop:
PHP Code:
   <?php
      $children
=getChildren('term-conditions');
 
     $ordered subval_sort($children'menuOrder');
    
?>
    <div class="parent">
      <?php foreach ($ordered as $child){?>
      <h2><?php getPageField($child'title'); ?></h2>
      <?php }; ?>
    </div> 

The $ordered variable do nothing. Why?
Reply
#2
Hello?

Can anyone can help me to order this list?
Reply
#3
(2019-02-15, 03:05:04)SalamandersPL Wrote: Hello?

Can anyone can help me to order this list?

In theme folder create functions.php and add this code:
PHP Code:
function getChildrenTitle($page)
{
    $children getChildren($page);
    foreach ($children as $subpage)
    {
        $title returnPageField($subpage,'title');
        echo '<div class="parent">';    
            echo 
'<h2>'.$title.'</h2>';
        echo '</div>';
    }    


Call the function in template:
PHP Code:
<?php getChildrenTitle('term-conditions');?>
Reply
#4
Still, i have them ordered different way on the page than in GetSimple.

https://salamanders-studio.com/temp/getsimple.png
https://salamanders-studio.com/temp/result.png

(if you ask about my getsimple look: this is a css plugin, not modified core)
Reply
#5
(2019-02-18, 19:27:07)SalamandersPL Wrote: Still, i have them ordered different way on the page than in GetSimple.

https://salamanders-studio.com/temp/getsimple.png
https://salamanders-studio.com/temp/result.png

(if you ask about my getsimple look: this is a css plugin, not modified core)

I see that you use numbers in the title (h2).

So try this code:
PHP Code:
function getChildrenTitle($page)
{
    
$children getChildren($page);
    
$pagesSorted subval_sort($childrenSORT_NUMERIC);
    
$pagesSorted array_reverse($pagesSortedtrue);
    
 
   foreach ($pagesSorted as $subpage)
 
   {
 
       $title returnPageField($subpage,'title');
 
       echo '<div class="parent">'   
            echo 
'<h2>'.$title.'</h2>';
 
       echo '</div>';
 
      

Reply
#6
Your code gave me this:

https://www.salamanders-studio.com/temp/result2.png

Well, it would be great to have that option to sort it same as displayed in CMS.
And what is "menuOrder" for?

Smile
Reply
#7
(2019-02-20, 09:43:03)SalamandersPL Wrote: Your code gave me this:

https://www.salamanders-studio.com/temp/result2.png

Well, it would be great to have that option to sort it same as displayed in CMS.
And what is "menuOrder" for?

Smile

Do you have install i18N plugin? If you have, create a new component (Theme->Edit Components) with this code:

Component name -> custom-nav
PHP Code:
<li class="<?php echo $item->classes; ?>">

 
 <a href="<?php echo htmlspecialchars($item->link); ?>">
 
   <?php echo htmlspecialchars($item->title); ?>
  </a>
 
  <?php if ($item->isOpen) { ?>
    <ul><?php $item->outputChildren(); ?></ul>
  <?php ?>
</li> 
In template add this:
PHP Code:
<?php if (return_page_slug()=='term-conditions') { ?>    
    <ul class="tree">    
    <?php get_i18n_navigation('term-conditions',1,100,I18N_SHOW_NORMAL'custom-nav'); ?>
    </ul>
<?php ?>
Reply
#8
You are a great man. Thank you!
Reply
#9
(2019-02-20, 22:34:40)SalamandersPL Wrote: You are a great man. Thank you!

You're welcome!
Reply




Users browsing this thread: 1 Guest(s)