Jump to content

Open Coterie  ·  19 members

SMF Staff People

Error with Unread Posts


Snickerdoodle
 Share

Recommended Posts

The display.template.php file already has something like that

// Show the topic information - icon, subject, etc.
	echo '
			<div id="forumposts">
				<div class="cat_bar">
					<h3 class="catbg">
						<img src="', $settings['images_url'], '/topic/', $context['class'], '.gif" align="bottom" alt="" />
						<span id="author">', $txt['author'], '</span>
						', $txt['topic'], ': ', $context['subject'], ' &nbsp;(', $txt['read'], ' ', $context['num_views'], ' ', $txt['times'], ')
					</h3>';
			if(!empty($context['topic_description']))
				echo '<p>',$context['topic_description'],'</p>';
			if(!empty($context['topic_date']['month']))
				echo '<p>',$context['topic_date']['month'],' ',$context['topic_date']['day'],', ',$context['topic_date']['year'],'</p>';
				echo '
				</div>';

And it's coming back with an error from the display.php... 8: Undefined index: topic_date

Link to comment
Share on other sites

Mk, so topic descriptions should be working in thread display, then.

 

The only reason for the latter I can think of is it's not attached to topic_date, but it should be.

Search for:

    // Set the topic's information for the template.

In Display.php and check. $context['topic_date'] should be defined there.

nusignature.png nusignature.png

I am the darkness, always watching, always listening, ALWAYS THERE.
(If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.)

Link to comment
Share on other sites

It's there 

// Set the topic's information for the template.
	$context['subject'] = $topicinfo['subject'];
	$context['num_views'] = $topicinfo['num_views'];
	$context['mark_unread_time'] = $topicinfo['new_from'];
	$context['topic_description'] = $topicinfo['topic_description'];
	$context['topic_date'] = array(
		$context['topic_date']['month'], $context['topic_date']['day'], $context['topic_date']['year'],

 

Link to comment
Share on other sites

It should look like this:

	// Set the topic's information for the template.
	$context['subject'] = $topicinfo['subject'];
	$context['num_views'] = $topicinfo['num_views'];
	$context['mark_unread_time'] = $topicinfo['new_from'];
	$context['topic_description'] = $topicinfo['topic_description'];
	$context['topic_date'] = array(
		'month' => !empty($topicinfo['date_month']) ? $txt['months'][$topicinfo['date_month']] : '',
		'day' => !empty($topicinfo['date_day']) ? $topicinfo['date_day'] : 0,
		'year' => !empty($topicinfo['date_year']) ? $topicinfo['date_year'] : 0,
	);

 

nusignature.png nusignature.png

I am the darkness, always watching, always listening, ALWAYS THERE.
(If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.)

Link to comment
Share on other sites

Ok. No more errors. That was the file I added that to instead of display template... replaced the other bit, rather.

 

Still isn't showing anywhere. Not in the topic list or in the thread. I'm not sure which it's supposed to show in or if it's both.

Link to comment
Share on other sites

Should at least be the topic display (?topic=#). The other topic just reminded me of it so make sure there are no mod conflicts. Otherwise, you'll want to check the database, descriptions should be saving in the _topics table... I can't honestly remember right now wtf the column is called, it's probably topic_description or something, just make sure that column's getting a value when you input a description.

If it's not, I'll... stare at it on my install, when I wake up. lol

nusignature.png nusignature.png

I am the darkness, always watching, always listening, ALWAYS THERE.
(If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.)

Link to comment
Share on other sites

The only other mods I have are SimplePortal and Password Protect Boards. The Topic Descriptions mod has been completely removed. I don't think anything is conflicting. The only edits I've made have been to change colors, add placeholder text, fix the description of avatar dimensions, and fix the error with changing post counts with characters with no posts.

 

Edit: And I wasn't able to find any saved descriptions in the database

Edited by Snickerdoodle
Link to comment
Share on other sites

Hmm, if it's not saving to database, something must have really broken then. Put in a support ticket, and give me a temporary admin login, and I will look at it when I wake up. 

nusignature.png nusignature.png

I am the darkness, always watching, always listening, ALWAYS THERE.
(If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.)

Link to comment
Share on other sites

Well, I just now got it working from reading the other thread, but I was wondering how I'd get it to show up inside the thread, if I can. It's not absolutely necessary, just curious if it can be done. I'm assuming there's a relevant place to stick that 't.topic_description,' to do that.

Also, reading that thread, I have been trying to get the character and OOC names to show up at the right time on the index and boards. They post correctly everywhere else, just not those two areas. I corrected the mistake you pointed out (with ['last_post']['member'] etc) and did the same to ['first_post'] like @Jones said, but there was no change. Undoubtedly, it's user error lol. Probably changed the wrong file.  (it was messageindex.template btw)

Also... this is frustrating, but I love working out problems and solving puzzles, so it's oddly relaxing at the same time. xD  I should probably just leave this kind of puzzle solving to the professionals like you, though 9.9;

Link to comment
Share on other sites

To get the topic description to show up inside of the thread, you just need to add $context['topic_description'] in to your Display.template file. I didn't realize the poster info was not showing up on my main index either. I'll have to fix that. xD The edits for it will need to happen in the BoardIndex.template files. It's probably going to be a lot like the edits for the messageindex.template but I'll let you know specifically what I do once I do it.

 

By the way, here is a handy list of all the templates and what they control http://wiki.simplemachines.org/smf/Templates_-_Is_there_a_list_of_templates I use it a LOT to figure out where I need to go to edit what I'm trying to edit lol. 

 

 

Okay so in BoardIndex.template.php find 

					   	', $board['last_post']['link'], '<br />
						', $txt['by'], '
						', $board['last_post']['member']['link'] , ' <br />
						', $board['last_post']['time'],'

and change it to

					   	', $board['last_post']['link'], '<br />
						', $txt['by'], '
						',(!empty($board['last_post']['character']['link']) ? $board['last_post']['character']['link'] : $board['last_post']['member']['link']),' <br />
						', $board['last_post']['time'],'

That should have your poster displaying right from the index. 

Edited by Jones

 

operation: bowtruckles & bombs

R6MmD.png

Link to comment
Share on other sites

Oooooo that list of templates will help a ton. I really appreciate that. 🙂

 

This is in my display.template

// Show the topic information - icon, subject, etc.
	echo '
			<div id="forumposts">
				<div class="cat_bar">
					<h3 class="catbg">
						<img src="', $settings['images_url'], '/topic/', $context['class'], '.gif" align="bottom" alt="" />
						<span id="author">', $txt['author'], '</span>
						', $txt['topic'], ': ', $context['subject'], ' &nbsp;(', $txt['read'], ' ', $context['num_views'], ' ', $txt['times'], ')
					</h3>';
			if(!empty($context['topic_description']))
				echo '<p>',$context['topic_description'],'</p>';
			if(!empty($context['topic_date']['month']))
				echo '<p>',$context['topic_date']['month'],' ',$context['topic_date']['day'],', ',$context['topic_date']['year'],'</p>';
				echo '
				</div>';

Is that the same?

 

And that part of my boardindex.template looks like this:

<p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
						', $txt['in'], ' ', $board['last_post']['link'], '<br />
						', $txt['on'], ' ', $board['last_post']['time'],'
						</p>';

I tried just changing the ', $board['last_post']['member']['link'] , ' <br /> part and it didn't do anything.

Link to comment
Share on other sites

I'll extricate myself from bed in a second, but quick note on the topic description in threads, if the code for it is still in the cat_bar div, then you won't be able to see it on any theme that follows curve's logic, because cat_bar has a set height and hidden overflow. So just move it in the display template outside that div and voila. 

  • Fuck Yeah! 1

nusignature.png nusignature.png

I am the darkness, always watching, always listening, ALWAYS THERE.
(If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.)

Link to comment
Share on other sites

Ayyy, I was just typing 'I'm sure Arceus will have a better idea.' When she posted. Lol. Hopefully that solves your issue. As for the boardindex.template if you change just the ', $board[last_post']['member']['link'],' </br> part replace just that part with 

',(!empty($board['last_post']['character']['link']) ? $board['last_post']['character']['link'] : $board['last_post']['member']['link']),' <br />

 

  • Like 1

 

operation: bowtruckles & bombs

R6MmD.png

Link to comment
Share on other sites

Yaaaay the descriptions are now in the threads. Thank you both!

 

Now to figure out why names aren't showing up the way they're supposed ta. After that, I should be golden... and maybe I'll take another stab at figuring out how to use NPCs lol... I only recently found the group permission settings for them. xD

Link to comment
Share on other sites

Yeah idk why I put it there, that wasn't smart, but hindsight's 20/20 or whatever. lol

 

The code Jones just posted will work anywhere the character names aren't showing, just follow the logic in the coding that's there and adjust the new code to suit it. Ummmm and NPCs work just like regular characters, tbh. They just might show up for players they don't belong to in the post as drop if their permissions let them post with NPCs that aren't theirs.

nusignature.png nusignature.png

I am the darkness, always watching, always listening, ALWAYS THERE.
(If you're interested in Plain of Ice, message me, it's private. Bleach site, non-canon.)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Guidelines and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.