TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,230
  • Total Topics: 21,353
  • Online today: 446
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 509
  • Total: 509

[solved] Navigation: "page" as replace for "current_board"

Started by ianus, August 17, 2007, 03:11:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ianus

Greetings!
In my opinion, a proper navigation is a basic, so I try to figure out a special solution.

IÃ,´m running TP 0.9.8 and SMF 1.1.2.

There is an external html file for the Navigation (with some CSS and a simple list.). This navigation.html is SMF & TP independent and not an Article.

I call this file in a block with an array and a little bit of php-code. The numbers in the array are similar to the board-number.

$g2 = array('39','43');
$bioshock = array('55','64');

if (isset($context['current_board']) && in_array($context['current_board'], $bioshock))
include ("../nav/bioshock_nav.html");

elseif (isset($context['current_board']) && in_array($context['current_board'], $g2))
include ("../nav/g2_nav.html");


ââ,¬Â¦ and so onââ,¬Â¦

What happens?
The array include the number of a board (or subboard) and if I navigate to this board, the adequate navigation.html is shown in the block. Since I still cant make a block appear in multiple places, this solution is my supersede. (http://www.tinyportal.net/index.php?topic=10986.0)

You can see an example, for the code given above here:
http://www.firopolis.de/forum/index.php/board,55.0.html (This is for Bioshock)
http://www.firopolis.de/forum/index.php/board,39.0.html (This is for G2)
(Its an German page, but you will see the example in the left block ââ,¬Å"Foren-Inhaltââ,¬Å")


Until this point, everything belongs to SMF and is working as wanted.

Now we switch to the TP part, because I like to use some Articles and in the URL it shows page=number
(example: http://www.firopolis.de/forum/index.php?page=18)
This page should have the same navigation menu like the corresponding board.

The Question is, how to add the page number to an array and what is the alternative short text for  ['current_board'].

Thanks ahead !

IchBin

I would imagine you could just grab the page from $_GET and put it into an array.
$page = array();
$page[] = $_GET['page'];

Then just check to see if inarray for $page. I don't understand what you're asking about short text for current_board.

ianus

Greetings!

Quote from: IchBinâ„¢ on August 17, 2007, 04:03:57 PM
I don't understand what you're asking about short text for current_board.

Sorry, my fault! I grab this from a dictionary, with the hope to be exact. Well, it seems the opposite is the case.

Well, never mind. Your idea is perfect and lead me to the solution.
Not very comfortable to administrate, but it serve the purpose.
I have to figure out some better php-code, imho.


The code I have written:

$bioboard = array('55','64');
$bioarticle = array('18');
$bioarticle[a] = $_GET['page'];

if (isset($context['current_board']) &&
in_array($context['current_board'], $bioboard))
include ("../nav/bioshock_nav.html");

elseif (isset($bioarticle[a]) &&
in_array($bioarticle[a], $bioarticle))
include ("../nav/bioshock_nav.html");




Thank you very much indeed!

ianus

Grettings!

Mm, itÃ,´s me again, the guy with the lack of php knowledge.

As mentioned above I this code in a php sideblock to show the ../../nav.html

$bioarticle = array('18');
$bioarticle['a'] = $_GET['page'];

elseif (isset($bioarticle['a']) &&
in_array($bioarticle['a'], $bioarticle))
include ("../nav/bioshock_nav.html");


If I view the article, the nav.html is shown inside the block, as I wish.

But there is an error message too.
If I navigate through the board, Article and thread independent, every klick showââ,¬Â¦
ââ,¬Â¦on a TP site
Undefined index: page
/is/htdocs/my webpack/www/forum/Themes/default/TPortal.template.php (main_above sub template - eval?)
Zeile: 12

..on an SMF thread
Undefined index: page
/is/htdocs/my webpack/www/forum/Themes/default/MessageIndex.template.php (main_above sub template - eval?)
Zeile: 12


Row 12 calls the theme_linktree()

So I am sure, that I have a typo in the above code, but I donÃ,´t now how to solve it.
Maybe some masterminds here? Sure!
Someone with a hint?

IchBin

$_GET['page'] is not set. By "not set" I mean, that it has no value. When you are accessing an article you'll notice in the URL that "page" is set. So when you are on a page that isn't an article it throws an error because it cannot define the index. :)

The following may solve your problem.

if (isset($_GET['page']))
$bioarticle['a'] = $_GET['page'];

ianus

Greetings!

Sorry for the late reply. A lot of work this weekend.

I think I understand what you explained. Thanks for the extra knowledge.
The code donââ,¬â,,¢t bring up an error everything seems ok. No error messages at the moment.

Thanks again ââ,¬â€œ and a lot.

In general my solution is way to complicated, but your kind help makes my life a little bit more easy.

This website is proudly hosted on Crocweb Cloud Website Hosting.