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 861 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 861 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
snippets for php code?
#1
hi people.
i just need a children list. it should work like list of childs that shown in a content area of a parent page if it has any children.
may be it is already done, but i didn't find. all the existing plugins are about menus but not about children list. may be it is possible to create children-only list with i18n menus, but...

so i've created my own php-snippet. and i want to place it on certain blocks of my template, or in a age conent area. existing components system is good but it is only for html code snippets.

so the question is: where i can save my php-snippets and easily connect them to certain pages.

now i just wrote this code in first lines of my template to colect children in a variable special_content. i want to place it to a snippet somehow:

Code:
$parents=array('izdeliya','sertifikaty');
$cur_slug=return_page_slug();
if (in_array($cur_slug,$parents)){
$P=array();
$i='0';
foreach(menu_data() as $el){
    if($el['parent_slug']==$cur_slug){
        $P[$i]['id'] = $el['menu_priority'];
        $P[$i]['title'] = $el['title'];
        $P[$i]['url'] = $el['url'];
        $P[$i]['slug'] = $el['slug'];
    }
    $i+=1;
}
rsort($P);

$special_content='<div id="content" class="innerBlock">';
         foreach($P as $pbl) {
             $special_content.='<ul>';
             $special_content.='<li><a href="'.$pbl['slug'].'">'.$pbl['title'].'</a></li>';
             $special_content.='</ul>';
         }
$special_content.='</div>';

it's probably could be done with i18n-menu plugin, but anyway. ehat if i have some code and i want it to be a pluggable chunk. like in mod-x evolution.
Reply
#2
"existing components system is good but it is only for html code snippets."

components are php
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
I think this should work although i have not really tried it:
Turn your snippet into a function and place it in the functions.php file in your theme directory, then make a component whose only job is to call the function.

OBTW ... What does "Warning Level: 0%" mean in my profile, and is it something I should be concerned about?
Reply
#4
Or a function in components just use php tags.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply




Users browsing this thread: 2 Guest(s)