Wish I could help. That's the point where it becomes greek to me smile

Are those spans in the $append? If so leave them open.

bingiman wrote:
MattF wrote:

The only problem with truncation is that it screws the W3C compliance if it happens to trim the message inbetween a pair of tags. big_smile

Actually, this is true but soonotes (tinytim) managed to resolve this issue with his User Blogs.

Yeah, had to do some searching to get that to work as the function for it is beyond my abilities. I would love to give proper credit for the functions below but I lost that info and have not been able to find it again.

Here's the code from blog.php where I call the function

                //First we parse the message
                $pre = parse_message($cur_blog['blog'], $cur_blog['hide_smilies']);

                // Now we trim it
                $str = truncate ($pre, $id);

$pre parses the message normal pun style (ie $cur_post) and then the truncate function is called.

The message and the blog id are required due to the fact the function also adds a 'read more' link.

Below are two functions actually. The truncate function does just that. The close tags function closes any open tags and is fully xhtml 1.0 compliant (ie. it accounts for self closing tags like img)

You should be able to use this without much trouble for what you want to do.

If you look at the truncate function you'll notice $len which sets the amount of characters to display. You will probably want to hard code that. (ie. $len = 400;)

The other variable you need to adjust is $append which adds the read more link.

Hope that helps.


//
// Close any open tags when truncating a blog
//

function close_tags($string)
{
  // match opened tags
  if(preg_match_all('/<([a-z\:\-]+)[ >]/', $string, $start_tags))
  {
    $start_tags = $start_tags[1];

    // match closed tags
    if(preg_match_all('/<\/>([a-z]+)>/', $string, $end_tags))
    {
      $complete_tags = array();
      $end_tags = $end_tags[1];
    
      foreach($start_tags as $key => $val)
      {   
        $posb = array_search($val, $end_tags);
        if(is_integer($posb))
        {
          unset($end_tags[$posb]);
        }
        else
        {
          $complete_tags[] = $val;
        }
      }
    }
    else
    {
      $complete_tags = $start_tags;
    }
    
    $complete_tags = array_reverse($complete_tags);
    for($i = 0; $i < count($complete_tags); $i++)
    {
      $string .= '</' . $complete_tags[$i] . '>';
    }
  }
  // Removes the </img> tag
$xhtml_tags = array("</img>", "</hr>", "</br>");
$string = str_replace($xhtml_tags, "", $string);
  return $string;
}





//
// Truncate string longer than max length
//

function truncate($str, $id) {
    global $pun_config;
$len = $pun_config['b_blog_trun_length'];
$splitter = '<!--MORE-->';
$append = ' ... <span class="barlink"><i><a href="blog.php?cid='.$id.'&c_id='.$id.'">Full Blog';
    if(strlen($str) <= $len){
        return $str;
    }
    if($len > 0 && !strstr($str,$splitter)){
        preg_match('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){'.$len.',}\b#U', $str,$matches);
        $str = $matches[0];
        # remove trailing opener tags and close all other open tags:
        $str = close_tags(preg_replace('#\s*<[^>]+>?\s*$#','',$str).$append);
    } else {
        $arr = explode($splitter,$str,2);
        $str = $arr[0];
    }
    return $str;
}

29

(16 replies, posted in Feature requests)

Oh $*@&, forgot about this smile

I'll get on this in a couple of days. Been pretty busy. Shouldn't be a mod that requires much modding anyway.

It works fine for everyone else. Try going through the install steps again and make sure you didn't miss something.

Have there been any error messages? Have you enabled debug mode and looked if any queries take place when you click on submit? We need more information to help.

31

(13 replies, posted in PunBB 1.2 show off)

Shows up fine now.

32

(13 replies, posted in PunBB 1.2 show off)

It doesn't work. I'm assuming there should be content in the middle but I just see black space. None of the links do anything either. Using latest version of Opera with Vista.
http://img509.imageshack.us/my.php?imag … d01ar9.jpg

33

(16 replies, posted in Feature requests)

I think that's a great idea!

I'll make up a mod for that when I get a chance. A quick change to search.php lets you show all posts pretty easily. Example of all posts

The mod you linked to does not give the user an option to enable/disable in the users profile. Which mod are you using?

Just change the default from 0 to 10

      ADD COLUMN reputation_plus INT(11) UNSIGNED DEFAULT 10,

Registered and posted a test message. No issues at all. Not sure why you wanted someone to do that though. The answer is here.

37

(89 replies, posted in PunBB 1.2 discussion)

I use a slightly different solution for spammers. I have a submission form on my site (no visible links) the bots latch onto. I get a couple of submissions daily with the cialis, viagra crap etc. and the occasional virus (small attachments are permitted) which come in email and are filtered into a junk mail folder which I check and empty now and then.

So the bots use that form and leave the forums alone. Works like a charm. As for the topic here I'm with the minimalists. It's not hard to install a mod if needed.

Those stats only show on the index page and that is where they are generated.

Around line 150 of index.php you see

// Collect some statistics from the database

From there down to about line 203 the stats are collected and displayed.

http://www.punres.org/files.php?pid=354

Not quite what you asked but gives all users to 'hide' from the online list.

Keep in mind if using the 'online today' mod it would still show all users even if they chose to be hidden.

40

(23 replies, posted in General discussion)

You changed the name, basically replaced Pun with Sun everywhere it shows. You changed the footer a bit. Ok, I don't get it. You released an incomplete version of Pun 1.3 under a different name. What's the point?

What bugs have you 'fixed' to make it 'stable'?

Create a new template file based on the original main.tpl

Open header.php

find

else if (defined('PUN_HELP'))
    $tpl_main = file_get_contents(PUN_ROOT.'include/template/help.tpl');
 

change to

else if (defined('PUN_HELP'))
    $tpl_main = file_get_contents(PUN_ROOT.'include/template/help.tpl');
else if (defined('PUN_ALT'))
    $tpl_main = file_get_contents(PUN_ROOT.'include/template/new_template.tpl');

In the files you want a different template for add

define('PUN_ALT',1);   

before the header is called.

Where is it? In the config table in the db, stored in cache/cache_config.php and set in admin_options. Hope that helps, not sure what you're asking.

bingiman wrote:

If all goes well tonight I will release it tomorrow morning on my site.

Are you planning on releasing this to PunRes also?

44

(2 replies, posted in General discussion)

nice

45

(13 replies, posted in PunBB 1.2 troubleshooting)

Yeah, but it generates the cache file.

46

(13 replies, posted in PunBB 1.2 troubleshooting)

The part of parser.php you posted looks exactly like it should then. Double check the parts of it that were modified.

As for the file cache_puntoolbar.php it looks like it was named incorrectly and should be puntoolbar.php

47

(13 replies, posted in PunBB 1.2 troubleshooting)

I changed something but it didn't show up. Like I said in my edit the if statement should be on a different line, don't know why the forum won't put it there. Is it on a different line in your parser.php

48

(13 replies, posted in PunBB 1.2 troubleshooting)

       // We found a [quote]or a [quote=username]if ($q3_start  min($q_end, $c_start, $c_end))

should be

        // We found a [quote]or a [quote=username]if ($q3_start < min($q_end, $c_start, $c_end))

edit, for some reason the site wants to put the if ($q3_start... on the same line as the commented part. I'm guessing it's not on the same line in your code.

As for the missing file not sure since I cannot find this mod anywhere.

49

(8 replies, posted in PunBB 1.2 troubleshooting)

Now change it to the correct base url

You will need to delete the file cache_config.php in the forums cache directory also. I think CPanel should have a file manager for you to do that.

50

(8 replies, posted in PunBB 1.2 discussion)

There's a few packages of mods you can check into.

http://www.punres.org/desc.php?pid=253
http://www.punres.org/viewtopic.php?id=915

And a couple more I think too.

But since they are mostly done by active users here, and people of "trust" apprently, then why aren't they supported?

I don't know about that. Anyone can submit a mod.

If you're only looking for a few mods just install PunBB and then install the mods. It's not hard to do and it is a good way to get familiar with the way PunBB is coded.