1 (edited by bingiman 2007-10-31 00:37)

Topic: Trying to add a feature to Admin Options

I am trying to add a feature to my admin options and this is what I have so far:

                                <tr>
                                    <th scope="row">Slider Options</th>
                                    <td>
                                        <input type="radio" name="form[show_slider]" value="1"<?php if ($pun_config['o_show_slider'] == '1') echo ' checked="checked"' ?> /> <strong>Yes</strong>   <input type="radio" name="form[show_slider]" value="0"<?php if ($pun_config['o_show_slider'] == '0') echo ' checked="checked"' ?> /> <strong>No</strong>
                                        <span>When enabled, The sliding menu will be displayed on the main page.</span>
                                    </td>
                                </tr>

The next thing I did was to add the info to the DB by insertinga new row in the pun_config table. This is what I added:

o_show_slider

All I am trying to do is to have an option to turn on or off a slider menu in the ACP. The problem I am having is I don't know how to include the code in main.tpl

How would I call the below from main.tpl? Is it the same as <pun_include whatever.php>

<script type="text/javascript">
window.addEvent('domready', function() {
            var myMenu = new ImageMenu($$('#slider .slider'),{openWidth:215});
});
</script>
        <div id="sliders_container" align="center">
            <div id="slider" align="center">
                      <ul class="sliders">
        <li><a style="width: 95px;" href="search.php?action=show_new" class="slider opt1" ><span>Latest Posts</span></a></li>
        <li><a style="width: 95px;" href="news.php" class="slider opt2"><span>1</span></a></li>
        <li><a style="width: 95px;" href="news.php" class="slider opt3"><span>2</span></a></li>
        <li><a style="width: 95px;" href="news.php"><span>3</span></a></li>
        <li><a style="width: 95px;" href="news.php"><span>4</span></a></li>
        <li><a style="width: 95px;" href="news.php" class="slider opt6"><span>5</span></a></li>
                </ul>
            </div>
        </div>

2 (edited by MattF 2007-10-31 00:18)

Re: Trying to add a feature to Admin Options

<?php

if ($pun_config['o_show_slider'] == '1')
{
?>
   [your code here]
<?php
}

?>

Put that in a file in include/user, then use pun_include to include the file.

Re: Trying to add a feature to Admin Options

Thanks Matt. It worked great. big_smile

4

Re: Trying to add a feature to Admin Options

Glad you're sorted. smile