Jump to content

rsj1

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Posts posted by rsj1

  1. [!--quoteo(post=386148:date=Jun 20 2006, 10:32 PM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Jun 20 2006, 10:32 PM) [snapback]386148[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    That still requires user interaction to trigger the script, automation without a scheduling application like cron or scheduler is impossible.
    [/quote]
    Very true, but it looks like a great alternative to cron jobs if your host does not support them ;)
  2. A great looking alternative to cronjobs would be [a href=\"http://www.dwalker.co.uk/phpjobscheduler/\" target=\"_blank\"]http://www.dwalker.co.uk/phpjobscheduler/[/a] I found this free script by accident earlier today when I was looking for an script to automatically backup my databases to server. I havn't tested it but it looks like it could do what you are asking ;)
  3. 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:
    [code]<a href=\"FOUNDURL\">LINK</a>[/code] (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)

    [code]
    <?php

    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>";
        }

    ?>
    [/code]
    NOTE: $content is the variable the code returns and diaplys on the webpage

    Any help is much appreciated!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.