Please upgrade here. These earlier versions are no longer being updated and have security issues.

Easy Question - What <a href="???"> do I use to link to the user's post?

I want to turn the "Comments" text from the Voting plugin (shown in the photo) into a clickable link to the user's post.

Within my locale.php file I just need to know what url to reference to replace the "???"

$Definition['Comments'] = '<a href="???"';

image

Comments

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Text is static, content is dynamic. You can change text easily with your locale, but for a new functionality (make text to link) you'll need a custom theme or a plugin


    UnderDoghgtonight
  • kirkpa31kirkpa31 ✭✭
    edited November 2013

    @r_j It is possible to turn a text item to a link within your locale.php. Refer to this post where I made an addition to my locale that linked a custom page I created: http://vanillaforums.org/discussion/23385/karmaleaderboard-feedback-ideas#top

    My question wasn't regarding the feasibility of doing this within my locale.php. My question was regarding what is the formatting for the link that goes to the post when a user clicks on it? What is the href? As this link would be a dynamic link and not merely a static one. I'm guessing it has some % symbols in it - but i do not know.

  • kirkpa31kirkpa31 ✭✭
    edited November 2013

    The path would be something like <a href="/discussion/#/title"

    or

    <a href="<?php echo Gdn::Request()->Url(ConcatSep("/", "discussion", $Discussion->DiscussionID, Gdn_Format::Url($Discussion->Name)))?>" class="Identify"><?php echo T('<b style="font-size: 12px; font-style: italic">Click To Identify</b>');?></a>

  • kirkpa31kirkpa31 ✭✭
    edited November 2013

    Ok - I suppose this isn't as easy of a question as I thought it would be after more research on my part

    What I ultimately want to do is have the entire .Item box clickable to the post within, rather than just the title. So this way the user could click any part of the discussion box on the main page and be directed to the individual post's page.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited November 2013

    have the entire .Item box clickable to the post within, rather than just the title

    You could achieve this by using css.

    Take the the Title link and add a clear background to it the size of the box. Then make the z-index be on top of the other stuff. Adjust the index until the link is on top of everything else.z-index is the order of the layers on top of each other. It can be a negative number.

    .ItemContent.Discussion a.Title{
    background:url(transparent image)0 0 no-repeat;
    background-size:40px 680px;
    z-index:1;
    }
    kirkpa31R_JUnderDog
  • kirkpa31kirkpa31 ✭✭
    edited November 2013

    @vrijvlinder - Do I actually have to place a link to a transparent image? Right now the website doesn't recognize that line of code: background:url(transparent image)0 0 no-repeat;

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Do I actually have to place a link to a transparent image?

    Yes of course you do ....upload a transparent image and link to it...

    The idea behind this is to create a larger linkable area that covers the other stuff.

    You need to play around with the widths and heights. And also see if the other things in the list have a z-index applied to them if they do you need to adjust for that.

    It is a tricky thing but it can be done.

    if you do not use an image you can also extend the size of the link

    .Discussions .ItemContent a.Title {
    max-width: 680px;
    z-index: 1;
    }
    kirkpa31
  • CSS is the greatest - as are you

    Thanks!!!!!

    vrijvlinder
  • hgtonighthgtonight ∞ · New Moderator

    You could do this the same way the mobile theme does it. Via JS. Check out the mobile theme hooks file if you want to try it.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

    vrijvlinderkirkpa31
  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    @kirkpa31: You only get something with % sign (I'm not making fun of you - it's just that I do not know how to tell it in a better way) if the framework has a variable string to translate, but the text you wanted to substitute doesn't get the link address as a parameter.
    But I'm glad there was such a clever but easy to achieve solution from @vrijvlinder


    kirkpa31
  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited November 2013

    the js that hgtonight is talking about is this jquery which seems reasonably more practical. Makes sure that discussion clicks (anywhere in a discussion row) take the user to the discussion.

    jQuery(document).ready(function($) {
       $("ul.DataList li.Item").click(function() {
          document.location = $(this).find("a.Title").attr("href");
       });
    });
    
    kirkpa31
  • Thanks again @vrijvlinder and @hgtonight! Works perfectly

Sign In or Register to comment.