Page 1 of 1

Bread crumbs navigation

Posted: Tue Jul 24, 2007 8:12 pm
by ABTOP
I am trying to implement the same kind of bread crumbs navigation (plus other shortcuts on the right) as the forum's, except instead of "Index >> Forum >> Topic", I'd like to have "Index >> Quizzes >> Category >> Quiz" and "Index >> Quizzes >> Statistics" and so on. So I copied this navigation portion from my viewtopic_body.tpl with looks like

Code: Select all

<div class="forumline nav-div">
	<p class="nav-header">
		<a href="{U_INDEX}">{L_INDEX}</a> » <a href="{U_VIEW_FORUM}">{FORUM_NAME}</a> » <a href="{U_VIEW_TOPIC}" class="nav-current">{TOPIC_TITLE}</a>
	</p>
	<div class="nav-links">
		<div class="nav-links-left"> 
			{CURRENT_TIME}
		</div> 
		<a href="{U_VIEW_OLDER_TOPIC}">{L_VIEW_PREVIOUS_TOPIC}</a> | <a href="{U_VIEW_NEWER_TOPIC}">{L_VIEW_NEXT_TOPIC}</a>
	</div> 
</div>
Then I substituted the Quiz values, shortcuts for Creating a new quiz and for viewing the stats. I came up with

Code: Select all

<div class="forumline nav-div">
	<p class="nav-header">
		<a href="{U_INDEX}">{L_INDEX}</a> » <a href="{L_QUIZZES}" class="nav-current">{L_QUIZZES}</a>
	</p>
	<div class="nav-links">
		<div class="nav-links-left"> 
			<!-- BEGIN switch_user_logged_in --> 
			<a href="{U_PRIVATEMSGS}">{PRIVATE_MESSAGE_INFO}</a><br /> 
			<!-- END switch_user_logged_in --> 
			{CURRENT_TIME} | {S_TIMEZONE} 
		</div> 
		<!-- BEGIN switch_user_logged_in --> 
		{U_SUBMIT_QUIZ}<br /> 
		<!-- END switch_user_logged_in --> 
		{U_STATISTICS_LINK}  
	</div> 
</div>
How ever this works only for the first page.
The other pages, such as this one, are missing all the Quiz's navigational elements.
I am not very versed in php and well be over my head here, thus would greatly appreciate any advice.

Posted: Wed Jul 25, 2007 9:39 am
by battye
Yeah, that won't work.
You don't necessary need to use PHP for this, you can hard-code the links into the quiz files (all of the quiz files ending in .tpl)

Posted: Fri Jul 27, 2007 7:04 pm
by ABTOP
battye wrote:Yeah, that won't work.
You don't necessary need to use PHP for this, you can hard-code the links into the quiz files (all of the quiz files ending in .tpl)
I guess I didn't quite make myself clear.
When I wrote
"Index >> Quizzes >> Category >> Quiz",
I really meant something like
"Index >> Quizzes >> Category: Such and Such >> Quiz: My very funny quiz".
I can't accomplish that with static links.

Posted: Sat Jul 28, 2007 3:12 am
by battye
You can hard code it, just make a couple of alterations.

In quiz_category_body.tpl, use {U_QUIZZES} to display the category name.

I don't have enough time to give you all of the code edits (it would effectively be like writing another MOD) but hopefully this gets you on the right track.

In quiz.php, find

Code: Select all

$template->assign_vars( array(
				 "U_QUIZ_NAME" => $quiz_name,
In the "play" section, and after add something like:

Code: Select all

"U_CATEGORY_NAME" => switch_to_category_name($quiz_category),
And then use {U_CATEGORY_NAME} in the .tpl files in question for category name, {U_QUIZ_NAME} for quiz name.