Jump to content


Need a little help

  • Please log in to reply
2 replies to this topic

#1 rsj1

  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 20 June 2006 - 08:12 PM

Basically what my problem is (I can't post a link as my site contains adult rated material) my shoutbox to be frank sucks. But due to the script I am using (MKPortal) its the only one available that will display both in the portal and the forum (SMF) The problem I have is the latest shouts block is in a thin column on the right hand side of the page (it would look ugly if I moved it to the top) this is fine as long as people only post normal text. The problems come when somebody posts a url eg [a href=\"http://www.google.co.uk/search?q=php+htlp&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official\" target=\"_blank\"]http://www.google.co.uk/search?q=php+htlp&...:en-US:official[/a] this expands the column so the url does not get broken. This looks really ugly!

I now have a couple of choices, but as I am not that experienced with php (I get by, but am not great) I cannot code any of these myself.

Choice 1: As the message is posted I need to edit the script to check the text for urls and turn it into:
<a href=\"FOUNDURL\">LINK</a>
(where "LINK" is the actual text displayed.so it would turn [a href=\"http://www.google.com\" target=\"_blank\"]http://www.google.com[/a] into [a href=\"http://www.google.com\" target=\"_blank\"]LINK[/a]) before the message is entered into the database.

Choice 2: As the messages are viewed a bit of code would need to do exactly the same thing as above and turn the long links into [a href=\"http://www.google.com\" target=\"_blank\"]LINK[/a]

Choice 3: A bit of code that will truncate long strings of text (like urls) by either only showing the first 40 characters or by placing a space every 40 characters in the string.

Out of all three I would prefer choice 2. Here is the code that displays the shouts (I have annotated it as much as I can)


global $DB, $mklib, $mkportals;
$limit = $this->config['urlo_block'];
if (!$limit) {
    $limit = 5;
    $link_user = $mklib_board->forum_link("profile"); //uses a function in another script to get the base link to the users profile
    $query = $DB->query( "SELECT id, idaut, name, message, time FROM mkp_urlobox ORDER BY `id` DESC LIMIT $limit");
    while( $row = $DB->fetch_row($query) ) {
        $name = $row['name']; //The user who shouted's name
        $id_orig_name = $row['idaut']; // the user who shouted's member if
        $content .= "<tr><td class=\"tdblock\"><b><a href=\"$link_user=$id_orig_name\">";
        $content .= $row['name'];
        $content .= "</a></b>, on ";
        $content .= $mklib->create_date($row['time']);  //creates a date using a function in another script
        $content .= "</td></tr><tr><td>";

        $message = $mklib->decode_bb($row['message']); //grabs the message from the database and add the smilies

        //This is where the code editing $message would need to go
        $content .= $message;
        $content .= "</td></tr>";

NOTE: $content is the variable the code returns and diaplys on the webpage

Any help is much appreciated!

#2 rsj1

  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 21 June 2006 - 12:31 AM


#3 rsj1

  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 21 June 2006 - 02:05 PM

*bump* can anyone help with this?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users