Results 1 to 3 of 3

Thread: [RESOLVED] how do i get a value from a html file using php

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    Greater Manchester, UK
    Posts
    476

    Resolved [RESOLVED] how do i get a value from a html file using php

    I use a skybluecanvas as my cms however it has no longer has any developer community, so i thought i'd ask my question here.

    I have my main menu which is loaded using the code below.

    This code is in my template file, used to call the menu code:
    Code:
    <div id="menu">
    <!--#plugin:fragment(menu,view,menu=1)-->
    </div>
    I have a second menu stored in xml but cant display it, changing the value of 'menu' has no effect. However in the 'view.php' code below where i have marked, there is a number 1 that when i change to 3 loads my new menu.

    As an easy way round i tried to duplicate the menu code to create a new fragment but when i call it i only get a blank page as it loads the functions.php. So i need away to get the menu value from my template and pass it to view.php.

    menu/functions.php (this code is loaded before view.php):
    Code:
    <?php
    
    function the_class(&$item) {
        global $Filter;
        if ($Filter->get($_GET, 'pid', DEFAULT_PAGE) == $item->id) {
    		echo ' class="active"';
    	}
    	echo null;
    }
    
    function the_link(&$item) {
        global $Router;
        echo $Router->GetLink($item->id);
    }
    
    function the_text(&$item) {
        echo $item->name;
    }
    
    function not_valid_menu(&$item) {
        return empty($item->menu) || !$item->published;
    }
    
    ?>
    menu/view.php:
    Code:
    <?php
    
        global $Router; 
        global $Filter;
        
        $menu = $Core->SelectObj(
            $Core->xmlHandler->ParserMain(SB_XML_DIR . 'menus.xml'),
            1//<<<<< this is the value i need to change, the value of menu
        );
        
    ?>
    <div class="horizontal-menu">
        <?php if (count($data)) : ?>
        <ul id="mainmenu">
            <?php foreach ($data as $item) : ?>
            <?php if (not_valid_menu($item)) continue; ?>
            <?php if ($item->menu != $menu->id) continue; ?>
            <li<?php the_class($item); ?>>
                <a href="<?php the_link($item); ?>"><span><?php the_text($item); ?></span></a>
            </li>
            <?php endforeach; ?>
        </ul>
        <?php endif; ?>
    </div>
    If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.

    If you fail, try and try again, its the only way to success.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    Greater Manchester, UK
    Posts
    476

    Re: [RESOLVED] how do i get a value from a html file using php

    Not Resolved, but i found a work-around i'm happy with.
    If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.

    If you fail, try and try again, its the only way to success.

  3. #3
    New Member
    Join Date
    Jun 2012
    Posts
    1

    Re: [RESOLVED] how do i get a value from a html file using php

    Quote Originally Posted by chris1990 View Post
    Not Resolved, but i found a work-around i'm happy with.
    You could write like you did ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width