Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

CatIcon

SchryversSchryvers
edited October 2014 in Vanilla 2.0 - 2.8

Vanilla 2.1.3

I got CatIcon workin, @peregrine uploaded a zip on this forum somewere... cause my theme doesnt support IndexPhotos.

But, this is de code:

<?php if (!defined('APPLICATION')) exit();


// Define the plugin:
$PluginInfo['CatIcon'] = array(
   'Name' => 'CatIcon',
   'Description' => 'Add Category Icon',
   'Version' => '1.0',
   'Author' => "Peregrine",
);

class CatIconPlugin extends Gdn_Plugin {



    public function DiscussionsController_Render_Before($Sender) {
    if (IsMobile()) return;

    $Sender->AddCssFile($this->GetResource('design/caticon.css', FALSE, FALSE));
    }


    public function DiscussionsController_BeforeDiscussionContent_Handler($Sender) {
       if (IsMobile()) return;
     $DiscArgs = ($Sender->EventArguments['Discussion']);
    $catbase = strtolower(getvalue("Category",$DiscArgs));
    $catid = getvalue("CategoryID",$DiscArgs);
    $catbase = preg_replace("/\s+/", "-", $catbase) ; 
    echo $catbase;
    // base image on Category name
    // comment line below if images are based on categoryid
    $Image = Img("plugins/CatIcon/design/images/" . $catbase . ".png", array('class' => "ProfilePhotoSmall"));
    // base image on categoryID
    // uncomment line below if images are based on categoryid
    // $Image = Img("plugins/CatIcon/design/images/" . $catid . ".png", array('class' => "ProfilePhotoSmall"));
    echo $Image;

    }



   public function Setup() {
   }    

}

So why is this categorie name text showing next to the image?

«1

Answers

  • Options
    peregrineperegrine MVP
    edited October 2014

    http://vanillaforums.org/discussion/comment/198844/#Comment_198844

    also see http://vanillaforums.org/discussion/comment/208419/#Comment_208419

    you should have never gotten a premium theme that no else has:) you don't have the skills to modify it.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    So that text cant be deleted? cause then its good...

    and yes... i thought when i BUY an premium theme, i get support for it, but thats not true, the author doesnt response even.

  • Options

    the author isn't responsible for every single plugin you add.

    bottom line - you really need to study css - or hire (pay) a theme developer.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    but @peregrine, this text what is next to the image the name of the categories in text, is not css... thats just into the phpcode i provide you above? The css is almost empty so it needs to be in the php file...

    And maybe im going to bootstrap if this not gonna workout anymore.. but this is my last attempt really would that text gone, but cant find it into the php... am i this stupid ?

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited October 2014

    No, and Yes...

    You do need to fix that with css.

    If there is no css you make the css.

    This problem and the others are css problems.

    Please use chrome web inspector to see the element you want to change and create a rule for it if it does not exist.

    If you are using a common text editor to edit your files you may have problems after you reupload the file. What editor are you using ?

    add or edit this in the caticon css file

    ul.Discussions li img {
    height: 45px;
    width: 45px;
    float: left;
    padding-right: 10px;
    }
    
  • Options
    peregrineperegrine MVP
    edited October 2014

    .

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    peregrineperegrine MVP
    edited October 2014

    @Schryvers said:
    Vanilla 2.1.3

    I got CatIcon workin, peregrine uploaded a zip on this forum somewere... cause my theme doesnt support IndexPhotos.

    But, this is de code:

    mine was for 2.0.18.x and the icon is not clickable.

    all you have to do is delete line 29! in the code you posted.

    its to help you find the category name, if you don't know what it is called.

    better to use @hgtonight's plugin which is better suited for vanilla 2.1.x

    http://vanillaforums.org/discussion/comment/217487/#Comment_217487

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    SchryversSchryvers
    edited October 2014

    Hey @peregrine‌

    How do i add Alt and Title tags to the images?

    I want the Category name as Title tag to the Category image...

    My seo scan says it needs to get a tag.... can you help me out i cant figure it out everything i do turns out into a blank page!

  • Options
    peregrineperegrine MVP
    edited October 2014

    @Schryvers said:
    Hey peregrine‌

    How do i add Alt and Title tags to the images?

    I want the Category name as Title tag to the Category image...

    My seo scan says it needs to get a tag.... can you help me out i cant figure it out everything i do turns out into a blank page!

    @Schryvers

    you need to make some attempt to look beyond, and get ideas from elsewhere, the link I suggested already has an example.

    if you want to continue down the same route as the plugin at the top of discussion

    here is an example.

    $Image = Img("plugins/CatIcon/design/images/" . $catbase . ".png", array('title' => htmlspecialchars($catbase) ,
                                                                                  'alt' =>htmlspecialchars($catbase),
                                                                                  'class' => "ProfilePhotoSmall"));
       // turn image into a clickable item
       $Image = Anchor($Image, CategoryUrl($catid, '', '//'), 'CategoryPhoto');
    

    otherwise see http://vanillaforums.org/discussion/comment/217487/#Comment_217487

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    SchryversSchryvers
    edited October 2014

    @peregrine‌

    The changes gived me a Alt and title tag but its not clickable.. yes it clickable but only the 1px on the bottom of the catimage...

    link http://www.tattootalk.nl

  • Options
    peregrineperegrine MVP
    edited October 2014

    the way to make it work is switch to the default theme or bittersweet or bootstrap, or hire a custom ozone theme developer.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Yeah @peregrine i already saw it your too fast my friend.

    The changes you gave me a Alt and title tag but its not clickable.. yes its clickable but only the 1px on the bottom of the catimage...

    link http://www.tattootalk.nl see by yourself please, has something to do with the theme right?

  • Options

    yes the interaction between the two, see above.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    .CategoryPhoto {
        z-index: 200;
    }
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    That works good but not with my ozone theme.. the catimages are not gonna go under the topbar anymore :(

    can u have a look one more time? just scroll down and look left top at the cat images...

  • Options
    SchryversSchryvers
    edited October 2014

    i made the changes back,

    but if i add

    .CategoryPhoto { z-index: 200; }

    then the image go over my topbar if i scroll down like:

    but yes, they are totally clickable, only they go over the topbar...

  • Options
    peregrineperegrine MVP
    edited October 2014

    I understand. see http://vanillaforums.org/discussion/comment/218035/#Comment_218035

    you may like your theme, but it is so different from the "standards" and unless someone owns your premium theme and can help, you will continually beat your head against things. You capital YOU need to study css and php if you want to be in control and not at the mercy of your theme.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    @Schryvers

        .CategoryPhoto:hover {
        z-index: 200;
        }
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    SchryversSchryvers
    edited October 2014

    @peregrine thanks, that hover works a bit better but not as it should be, first you need to hit the bottom of the image with the mouse before its totally clickable.. www.tattootalk.nl

    Is it in the style itself something what couldnt be fixed?\

    I changed caticon.css a bit before this:

    `ul.Discussions li img {
    height: 53px;
    width: 43px;
    float: left;
    }

    .Discussion.ItemContent {
    padding-left: 55px;
    }`

Sign In or Register to comment.