376

(105 replies, posted in General discussion)

Well I am hoping so as well, but it doesn't' look good. As far as I can see no one is willing to lend a hand.

I am just asking for your opinion on the code above. I am not asking for any coding help. big_smile

378

(105 replies, posted in General discussion)

Yeah, I sorta figured it all out when I compared it. However, it still doesn't' work for the index. sad

I am no coder but I managed to whip this Latest Topics up using various code. I am not sure if it is correct but it does work. I would just like someone to tell me if everything in here is required or not. I have no clue what the censoring area of the code does. I am assuming that if censoring is turned on in the admin panel the results are shown here. One thing I do not understand is why I need to set the make topics displayed to (6) in order to show (5). However, if I remove the censoring code then a setting of (5) is (5). Anyway, just need someone to pick out the code that I need in here:


<?php

showRecent(); // Set amount of posts to be displayed here

function showRecent($show=10) {
    global $lang_common, $db, $pun_config, $pun_user, $db_prefix;
    $max_subject_length = 20;

    $order_by = 't.last_post';
    $forum_sql = '';



    $show = intval($show);
    if ($show < 1 || $show > $show_max_topics)
    $show = 6;
// Fetch $show topics
    $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.$order_by.' DESC LIMIT '.$show) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());


     $show_count = 0;
    if ( !$db->num_rows($result) ) return $output;
    while ( ($show_count < $show) && ($cur_topic = $db->fetch_assoc($result)) ) {
        $temp = '';

            while ($cur_topic = $db->fetch_assoc($result)) {
        if ($pun_config['o_censoring'] == '1')
     $cur_topic['subject'] = censor_words($cur_topic['subject']);
    $subject_truncated = pun_htmlspecialchars($cur_topic['subject']);
 
        if ($pun_config['o_censoring'] == '1')
            $cur_topic['subject'] = censor_words($cur_topic['subject']);
        if (pun_strlen($cur_topic['subject']) > $max_subject_length)
            $subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...';
        else

            $subject_truncated = $cur_topic['subject'];


    echo '<div class="l_icon"><strong><a class="l_icon_padding" href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.pun_htmlspecialchars($subject_truncated).'</a></strong></div><br /><div style="padding-left: 12px; font-size: 9px; font-family: Tahoma, Arial, Verdana; text-align: left;">by: '.pun_htmlspecialchars($cur_topic['poster']).'<br />'.format_time($cur_topic['last_post']).'</div><br />'."\n";
    }
    return;
    }
}

Thanks big_smile
Bingiman.

380

(105 replies, posted in General discussion)

The second part for the viewforum in that post does work, so now it is only the index to sort out.

381

(105 replies, posted in General discussion)

I was looking at this post. The code is in French so it doesn't rally help me maybe one of you guys can decipher it.

http://www.punres.org/viewtopic.php?pid=6925#p6925

I got it.

<?php
if ($pun_user['is_guest']){ ?>

        <li><a style="width: 95px;" href="register.php" class="slider opt3_register"><span>Profile</span></a></li>
    <?php } else { ?>
        <li><a style="width: 95px;" href="profile.php?id=<?php echo $pun_user['id'] ?>" class="slider opt6"><span>Profile</span></a></li>
<?php } ?>

Can someone please help me to format this line of code. I cannot get it to work no matter what I try. It is driving me mental.

<?php
if ($pun_user['is_guest']){
        echo '<li><a style="width: 95px;" href="register.php" class="slider opt3_register"><span>Profile</span></a></li>';
        else
        echo '<li><a style="width: 95px;" href="profile.php?id=<?php echo $pun_user['id'] ?>" class="slider opt6"><span>Profile</span></a></li>';
}
?>

I keep getting this error:

Parse error: parse error, unexpected T_ELSE in c:\punbb\include\user\slider_menu.php on line 30

I found the problem. You had: id=" and the quote should not have been there.

Thanks Matt

Bingiman

That still doesn't make a difference. sad

It doesn't work. This is all I get: http://192.168.0.104/profile.php?id=

The script works. This is the problem:

href="profile.php?id='.$pun_user['id'].'"

It can't read this line: '.$pun_user['id'].'"  - It just shows up exactly like that. I am guessing that I would also need a db query in there to grab the user info? I have no clue how to do it.

Is it possible for me to add a link to the user profile in main.tpl? If so, then how would I go about doing it?


Actually, It is in an external file located in the include/user folder.

Here is the code:

<?php

// Slider Menu
global $pun_config, $lang_common, $pun_user;

if ($pun_config['o_show_slider'] == '1')
{
?>
<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>News</span></a></li>
<?php

if ($pun_user['is_guest']){
        echo '<li><a style="width: 95px;" href="register.php" class="slider opt3_register"><span>Images</span></a></li>';
        }else{
        echo '<li><a style="width: 95px;" href="uploadimg.php" class="slider opt3"><span>Images</span></a></li>';
        }
?>
        <li><a style="width: 95px;" href="downloads.php" class="slider opt4"><span>Downloads</span></a></li>
        <li><a style="width: 95px;" href="page.php?id=3" class="slider opt5"><span>Rules</span></a></li>
        <li><a style="width: 95px;" href="profile.php?id='.$pun_user['id'].'"" class="slider opt6"><span>Profile</span></a></li>
                </ul>
            </div>
        </div> 
<?php
}

Thanks
Bingiman.

389

(105 replies, posted in General discussion)

Not yet...believe it or not all I've been doing is trying to get this to work. I am obsessed with it. I will probably have to pay someone to get it working for me. Anyway, I will try your mod out this week for sure. smile

390

(105 replies, posted in General discussion)

Anything so far guys?

Thanks Matt. It worked great. big_smile

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>
MattF wrote:

Hell no. I use PunBB for the simple fact that it starts as a bare bones system and you have to explicitly add what bits you require. I really dislike most other forum softwares extra features, and having to strip software is a damned sight harder than adding functionality to PunBB.

I have to agree with MattF here. This is what drew me to punBB. It is amazing what you can do with it from just the bare bones. I have dealt with quite a few CMS's and Forums but there is just something about punBB that keeps me going. I think it is safe to say that Ia m a bit obsessed with mod it. big_smile My personal opinion is this. There isn't any other script out there better than it.

Bingiman.

394

(105 replies, posted in General discussion)

ok, no problem. I will keep a lookout here.

395

(105 replies, posted in General discussion)

I am constantly trying different bits of code but nothing works so far. I was actually focusing on the index first but nada, zip, zilch so far. big_smile

My MSN is shedrock@sympatico.ca if anyone needs to contact me.

396

(105 replies, posted in General discussion)

on, well, I'll have to keep checking this post then. I'll wait because I reached so far with the mod and to turn back now would be a drag. not to mention I'd have to go back and reinstall the the mods since then on my old backup. sad

397

(105 replies, posted in General discussion)

Well, from what Smartys said, it seems like the whole thing has to be rewritten. I am no coder but I don't see what that would have to be done. The problem is with the index and the viewforum. I would imagine that and "if else" would do the trick in both files. I mean one is reading the parent forums and the other the subs. Then again, what do I know. I honestly wish I knew PHP and MySQL.

Bingiman

398

(105 replies, posted in General discussion)

Any progress on this Matt?

399

(105 replies, posted in General discussion)

ok, I understand. Is there anyone else who can help us out here?

400

(105 replies, posted in General discussion)

Smartys. Can you please help me with this?