[HELP] Tags with RevCMS

achtrey

New Member
Jul 1, 2012
14
1
So here's the deal.. I've been looking everywhere for a tags add-on for my hotel, and I finally found one.

Here's the script, Coded by Spartak by the way. my question is under the script - so don't forget to scroll!

Code:
<?php
$my_id = $_SESSION['user']['id'];
$fetch_tags = mysql_query("SELECT tag,id FROM user_tags WHERE user_id = '".$my_id."' LIMIT 20") or die(mysql_error());
$tags_num = mysql_num_rows($fetch_tags);
 
    $randomq[] = "What is your favourite food?";
    $randomq[] = "Who is your favourite actor?";
    $randomq[] = "What kind of music do you like?";
    $randomq[] = "What is your favourite sport?";
    $randomq[] = "Who is your favourite actress?";
    $randomq[] = "What is your favourite colour?";
    $randomq[] = "What is your favourite band?";
    $randomq[] = "What is your favourite TV show?";
    $randomq[] = "Which football team do you support?";
    $randomq[] = "What is your favourite football team?";
    $randomq[] = "Your favourite cartoon?";
    $randomq[] = "What is your favourite video game?";
    $randomq[] = "What's your favourite pastime?";
    $randomq[] = "What kind of mood are you in right now?";
    $randomq[] = "What is your favourite movie?";
    $randomq[] = "What is your favourite time of year?";
 
srand ((double) microtime() * 1000000);
$chosen = rand(0,count($randomq)-1);
 
$tag_question = $randomq[$chosen];
 
if( $_GET['do'] ) {
    $do = $_GET['do'];
    mysql_query("DELETE FROM user_tags WHERE id = '".$do."'");
    Redirect("me");
}
 
    if (isset($_POST['newtag']))
    {
    $user_id = $_SESSION['user']['id'];
    $tag = htmlspecialchars(addslashes($_POST[newtag]));
 
    if (strlen($user_id) < 1 || strlen($tag) < 1)
    {
    Redirect("me");
    }
    else
    {
        mysql_query("INSERT INTO user_tags (user_id    ,tag) VALUES ('" . $user_id    . "','" . $tag . "')");
    Redirect("me");
    }
    } ?>
 
    <HTML><div class="content-box-radio">
<div class="habblet-container ">
    <ul class="box-tabs">
        <li id="tab-3-2" class="selected"><a href="#">My Tags</a><span class="tab-spacer"></span></li>
    </ul>
  <br />
            <a href="me" class="tab-ajax"></a>
    </div>
    <div id="tab-3-2-content" >
    <div id="my-tag-info" class="habblet-content-info">
        <?php if($tags_num > 19){ echo "Max limit tag.delete one of your tag and then add."; } elseif($tags_num == 0){ echo "You dont have tag. Answere the question or make ur own."; } elseif($tags_num < 20){ echo "u dident use all of ur tags. Add more!"; } ?>
    </div>
<div class="box-content">
    <div class="habblet" id="my-tags-list">
 
<?php if($tags_num > 0){
            echo "<ul class=\"tag-list make-clickable\"> ";
    while($row = mysql_fetch_assoc($fetch_tags)){
    echo " <li><a href=\"tags?tag=".strtolower($row['tag'])."\" class=\"tag\" style=\"font-size:10px\">".strtolower($row['tag'])."</a>
                        <a href='?do=".$row['id']."' title=\"delete tag\"><img src='{url} /app/tpl/skins/habbo/images/tags/redminus.gif' /></a></li>";
    }
            echo "</ul>";
} ?>
 
<?php if($tags_num < 20){ ?>
    <form method="post">
    <div class="add-tag-form clearfix">
        <button type="submit" class="positive" name="submitcomment">OK</button>
        <input type="text" name="newtag" id="add-tag-input" maxlength="20" style="float: left"/>
        <em class="tag-question"><?php echo $tag_question; ?></em>
    </div>
    <div style="clear: both"></div>
    </form>
<?php } ?>
    </div>
</div>
 
<script type="text/javascript">
document.observe("dom:loaded", function() {
    TagHelper.setTexts({
        tagLimitText: "you have reached your tag limit - delete 1 if you want to add new one.",
        invalidTagText: "Invalid tag",
        buttonText: "OK"
    });
        TagHelper.init('21063711');
});
</script>
</div>
</HTML>


I put the script in me.php in a little box i made, and this is how it turns out

I can add tags, but when I do, it redirects me to a wierd looking site, which is supposed to be "/me" I think.. ,
When this happens, i have to refresh /me to get to the normal site where the tag is now added.
Also, you can't remove tags, like at all..
I've tried removing the box, but it looks exactly the same apart from that the box is gone. Lol captain.obvious!

Anyways, if someone knows how to fix this, i'd really appreciate it!
THanks in advance!!
 

Tash

Hi.
May 6, 2012
173
27
if it turns out like this
then obviously the code is messy
and you have to fix the code to make it work ;/
 

Users who are viewing this thread

Top