Important Question regarding a snippet of phpbb code

SilverWolf

Familiar Face
Joined
Apr 23, 2011
Messages
77
Reaction score
0
FP$
6
Hello people! The other admin of our Just Sayin' forum found out how to get the topic titles to show in the "last post" box, along with the name of the last poster. This is exactly what we wanted. However, there is something in the code for this that we do not understand...we are using PHPBB 3.0.8. here is the code:

'LAST_POST_SUBJECT' => (strlen($last_post_subject) > 30) ? censor_text(substr($last_post_subject, 0, 20) . '...') : censor_text($last_post_subject),

What does the code "(strlen($last_post_subject) > 30) ? " actually do? Basically, I would like to know it's function.

Also, what exactly does "$last_post_subject, 0, 20" do? I know that making the last number larger allows more of the title of the last topics to be visible on the index page, but after a certain point (25 or so), it makes the columns on the forum lose their proper alignment.

If someone could explain what the functioning of this code actually is, and how to properly use it, we would GREATLY appreciate it. Thanks :yes:

The forum can be found at: http://www.just-saying.com/community

~SilverWolf~
 
It isn't that bad... Only when moving a topic which has the latest reply. That is soon corrected when another user posts. We are using an older version of the mod though so in the latest version that issue is probably fixed.
 
Well, we aren't sure exactly how to install mods correctly LOL. Melane spent all day trying to figure out how to do this, finally found out how, but we would like to have it to where you can display a bit more--ideally most of the name of the topic. Problem is, we get it to where it does show most of the name, and the columns on the index page set all funked up.

I'll look into this mod, probably install it on a test forum I am making on my personal website (Melane and I have our own webhosts 😀 ). That way, if I screw something up, we don't mess up our "good" forum 🙂

Thanks for the reply. It would still be nice to know how to properly use that code though, in case that mod is buggy on our forum--or we can't figure out how to properly install it.
 
You don't actually need to know really and if your a novice at PHP it would only confuse than help (I don't mean to be rude). The $last_post_subject is a query that the PHP is being instructed to run so it will retrieve the last subject title from the database.
 
I downloaded that mod, but it doesn't have any installation instructions--so I'm not sure what to do with it, LOL.

Well Dan, do you know how to make those numbers a bit higher (showing a bit more of the title) without it making the index columns (the board name, post count, last topic columns) move out of alignment? That's really the biggest issue I'm having. I'm fairly happy with what is showing now, but it would be -nice- to show just a BIT more of the topic title there.
 
Editing the PHP code won't help as it has to be done via the database. The > 30 doesn't have anything to do with how much it shows because once you have installed the MOD, the options are available in the ACP.

1. Download the MOD from phpBB.com (latest version)

2. Extract the zipped file on your PC

3. Go to the root of the folder (on your computer) and open up "install.xml", it's something like that.

4. Read the instructions in there.

If you're not comfortable with installing MODs then I would suggest you ask someone else to sort this out and practice on a test board some easy MODs.
 
Thanks Dan 🙂

That is precisely why I just made a test board--so Melane and I can get more used to messing around with mods and (hopefully to some extent) coding one of these days. Better than testing this stuff on our main forum 😉

***EDIT***

I opened the xml file--it launched dreamweaver CS5. But where are the instructions? It seems to be a buch of code in there instead...
 
Son of a...why in the heck didn't I think of that...feelin a bit retarded now, LMAO!

Thanks alot Paine--that worked!
 
(strlen($last_post_subject) > 30)

That's just getting the last post subject's length and making sure it isn't over 30 characters (if it is, it shortens the title and I believe (controlled in the other pieces of code) it allows you to hover over the text and get the full title via a mouse over effect) which would make the index page look weird.

$last_post_subject, 0, 20

Makes it either between 0-20 characters (shortening it as stated above) obviously it's 1-20 (as you can't really have a title with 0 characters), if it happens to be more than 20 it cuts of and adds ... to the end to show that it's not the full title.

If you need anymore help understanding other bits of the code or whatever just PM me.
 
Back
Top Bottom