Main Stories
Slash Boxes

Slash Open Source Project

Slashcode Log In

Log In

[ Create a new account ]

Article Poll

Poll I found this article to be
Very Helpful
Not Helpful
Not Very Helpful
[ Results | Polls ]
Comments:0 | Votes:1

How do you get "written by"

posted by Krow on 07:34 AM February 15th, 2002   Printer-friendly   Email story
I've noticed that on articles that are submitted and approved are not 'Posted by' but 'written by'. How do I do it with my own Slash site? I've checked the code but I didn't find any clue. I would also like to be working for 200+ articles I've already in...
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login
Loading... please wait.
  • by Anonymous Coward
    root@my_machine:/usr/local/slash# grep -r -l -i "posted by" *

    Now go to the `Templates' option from your admin interface, and edit the necessary templates (I'm not quite sure, but I think you'll have to stop/start apache and slashd after those changes so you can see them right away).

  • The story behind this is that I post the vast majority of the stories on Slashcode. I got sick of seeing my name on ever post so I made use of the "submitter" field in the story schema. In my dispStory template is the following:
        [% users = Slash.db.getDescriptions('users'); key = story.submitter %]
            [% IF story.submitter == constants.anonymous_coward_uid %]
            <FONT FACE="[% constants.mainfontface %]" SIZE="1">written anonymously
            [% ELSE %]
            <FONT FACE="[% constants.mainfontface %]" SIZE="1">written by <A HREF="[% constants.rootdir %]/~[% users.$key | fixparam %]/">[% users.$key %]</A>
            [% END %]

    As you can see I grab a cached hash which is a map of all of the usernames and their uid. This would not scale to work on Slashdot, but for a site anywhere below 100K of users this should not be an issue. I have a couple of new tricks that I will be adding in over the next few days. One which has even gotten me more comments on other sites once I did it.

    Stay tuned.

    You can't grep a dead tree.