Fork me on GitHub

News Module - Link Article Contributor Name To Their Profile  Bottom

  • Need some help with this. I want to link the article contributor name to their zikula profile. How do I edit the template to link like that?

    Right now it looks like this:

    Code

    <span class="news_meta z-sub"><!--[gt text='Submitted']--> <!--[gt text='by %1$s on %2$s' tag1=$info.contributor tag2=$info.briefdatetime]--></span>


    Thanks!

    --
    WIRE SERVICE

    Free Press Releases
  • I think it is as follows:

    Code

    <span class="news_meta z-sub"><!--[gt text='Submitted']--> <!--[gt text='by %1$s on %2$s' tag1=$info.contributor|userprofilelink tag2=$info.briefdatetime]--></span>


    Greetings.. icon_biggrin



    Edited by lord on Nov 08, 2010 - 02:10 AM.

    --
    So sorry, my english is short.
  • Yes that should do the trick. Does it work for you ?

    --
    campertoday.nl, Module development, Dutch Zikula Community
  • for my yes..

    Erik i need to separately handle the date fields:

    Year
    Month
    day

    but are only available the following formats:

    Code

    longdatetime
    briefdatetime
    longdate
    briefdate


    as i do?
    Thank's!

    --
    So sorry, my english is short.
  • It didn't work for my setup. I included it in the news_user_index.htm file.

    I'm not familiar with the gettext stuff... but I don't see how it can be linked as it is.
  • lord


    Erik I need to separately handle the date fields:
    Year
    Month
    day
    but are only available the following formats:

    Code

    longdatetime
    briefdatetime
    longdate
    briefdate



    Hi those are the ones predefined in the News code. But you can also use the regular PHP date formatting strings (http://www.php.net/manual/en/function.strftime.php) if you use the original datetime variable $info.from that represents the start of publication.
    So %Y for a Four digit representation for the year, etc. The ones you mention above are shorthand notations for the same stuff.
    To explain how this works, see includes/DateUtil.class.php and the pnRender modified system/pnRender/plugins/modifier.pndate_format.php that calls the DateUtil class.
    As an example

    Code

    $info.from|pndate_format:'%a, %d %b %Y'
    Saturday, 12 Dec 2009

    So you can use the shorthand notations and your own. The shorthand notations are BTW also multilanguage proof, since they can be overridden in the translation of the Core. A date in america usually starts with month/day/year, but in europe a lot of countries use day/month/year, just an example.


    On the side: News 3.0 (that will be a pure zikula1.3 version) will have some cleanups in that area, where some predefined variables will be removed and the display code will be placed in the template. More clear for users and it removes code that might never be used. Better seperation of functionality and layout/display.



    Edited by espaan on Nov 09, 2010 - 11:33 AM.

    --
    campertoday.nl, Module development, Dutch Zikula Community
  • czardogs

    It didn't work for my setup. I included it in the news_user_index.htm file.
    I'm not familiar with the gettext stuff... but I don't see how it can be linked as it is.


    Hi did you make sure that the templates are re-compiled? So in pnRender and in the Theme settings do a remove compiled templates if necessary. This code like this in several other places in News, so it should be fine.
    What is does is call the pnRender modifier userprofilelink, which turns the contributor username into a link to his profile.

    --
    campertoday.nl, Module development, Dutch Zikula Community
  • I am using the code below in the news_block_storiesext_row template to show the avatar of the poster of the message. Since the upgrade to News 2.6.2 the avatar is not shown anymore but the alternative text. Is "$aid" still a valid variable for the user id of the poster?:

    Code

    <a href="https://www.tariqa.eu/module-Profile-view-uname-<!--[$aid_uname]-->.html"><img src="images/avatar/pers_<!--[$aid|pnvarprepfordisplay]-->.jpg" width="50" title="<!--[$aid_uname]-->" alt="<!--[$aid_uname]-->:" /></a>




    Edited by thilowitt on Nov 09, 2010 - 01:43 PM.
  • Hi, nope aid as a article variable has been removed. See also the release article in the ExtDB: http://community.zikula.org/module-Extensions-display-ot-component-componentid-29.htm

    Quote

    The 2.6.x serie contains database changes: backwards compatibility fields have been removed. This is because of the compatibility with Zikula 1.3. Check your templates for usage of old redundant fields that are not there any more
    (so now use cr_uid instead of aid, from instead of time, contributor instead of informant, hideonindex instead of ihome, disallowcomments instead of withcomm)


    For compatibility with the upcoming new version of the Zikula Core several redundant DB fields had to be removed. They were only there for backwards compatibility.
    The storiesext block still defines an extra variable aid_uname that still works. Now that you mention it I will make a ticket to maybe change this name in a new version as well, since it refers to a DB field that is not there any more.

    --
    campertoday.nl, Module development, Dutch Zikula Community
  • thank you!
  • espaan


    Code

    $info.from|pndate_format:'%a, %d %b %Y'
    Saturday, 12 Dec 2009



    Thanks

    --
    So sorry, my english is short.
  • It's not working for me. I've recompiled and cleared all temp files a number of times. Cleared my local cache and even tried it on my rarely used laptop and nothing.

    I'm using zikula 1.2.3 and the 2.6.1 news.

    I had another issue with the news module where it worked for others but not me - meta description.

    ~thanks

This list is based on users active over the last 60 minutes.