How do i use a custom index.php for component page

Moneya Posted in Component Development 7 years ago

How do i use a custom index.php page i built as an index in OSSN 4.x Component development

Replies
ng Moneya Replied 7 years ago

Hi @Zet Man
i have resolve the issue, but i have 1 problem left.
how do i use an icon for menu?

German Michael Zülsdorff Replied 7 years ago

Your component is missing a page handler.
Study the code and structure of the TETRIS game component. That's a simple example and you'll get an idea.

ng Moneya Replied 7 years ago

I am not trying replacing the OSSN custom index
i want a plugin to use a custom page for it's page
here's my code .
For ossn_com.php

    <?php

function hellos_init(){
    $hellos_url = ossn_site_url().'hellos';
    $icon = ossn_site_url('components/hellos/images/hi.png');
    ossn_register_sections_menu('newsfeed', array(
            'text' => 'Hello World',
            'url' => $hellos_url,
            'section' => 'links',
            'icon' => $icon
        ));

    ossn_register_page('hellos', 'hellos_page');
}
function hellos_page(){
    $title = 'Hellos';
    $contents = array('content' => ossn_view('components/hellos/index'));
    $content = ossn_set_page_layout('contents', $contents);
    echo ossn_view_page($title, $content);  
}

ossn_register_callback('ossn', 'init', 'hellos_init');

?>

and my index.php

<?php

echo "Hello World";
?>

German Michael Zülsdorff Replied 7 years ago

Pardon? It's not quite clear what you are trying to achieve.
A component may replace Ossn's default index.php. Yes. But it's completely up to YOU what code you're putting on it. :)