Author Topic: Navigation with vLIB  (Read 2580 times)

0 Members and 1 Guest are viewing this topic.

Solaris

  • Guest
Navigation with vLIB
on: Thu, 15. December 2005 - 14:19:32
I want to create a breadcrumb, navigation and sitemap with vlibTemplate and vlibDate.

I have a function which returns an array:
category => News
datetime => 2005-12-15 8:37:21
parent_id => 1

or do I have to work with "setdbloop".

Is is it possible to use vlibDate and vlibTemplate? Do I have to use plain PHP for that?

Regards,
Solaris

Guest

  • Guest
Navigation with vLIB
Reply #1 on: Mon, 19. December 2005 - 18:46:24
Quote
I want to create a breadcrumb, navigation and sitemap with vlibTemplate and vlibDate.

I have a function which returns an array:
category => News
datetime => 2005-12-15 8:37:21
parent_id => 1

or do I have to work with "setdbloop".

Is is it possible to use vlibDate and vlibTemplate? Do I have to use plain PHP for that?

Regards,
Solaris
Hi Solaris,

if you are working with an Array it doesnt make any sense to use the setdbloop.
This fuction is ONLY to work with MySQL SQL Return Arrays. Please use instead the funtion setloop. By the way - why you are using an array here?

Werner
Last Edit: Mon, 19. December 2005 - 20:41:31 by ClausVB

Offline ClausVB

  • Administrator
  • Hero Member
  • *****
  • Posts: 566
    • Homepage: clausvb.de
Navigation with vLIB
Reply #2 on: Mon, 19. December 2005 - 21:08:22
Quote
I have a function which returns an array:
category => News
datetime => 2005-12-15 8:37:21
parent_id => 1

I am not sure what you want to accomplish with your "parent_id", but you can use "setdbloop" like this:

Code: [Select]
SELECT author_name, IFauthor_name = ClausVB, 1, 0 AS boolean, DATE_FORMATFROM_UNIXTIMEpost_date, %W, %d %M %Y AS date_english FROM vlib_posts
If you have an existing array you can
- edit "datetime" with vlibDate
- use "parent_id" like you want to
and use create an LOOP-Array with "array_push" like

Code: [Select]
table_data = array;
 � �while row = mysql_fetch_assocresult
 � �{
 � � � �array_pushtable_data, array
 � � � � � �category = rowcategory,
 � � � � � �birthday = date-formatDatesubstrrowdate_time, 0, 10, �%a, %d.%m.%Y,
 � � � � � �parent_id = rowparent_id
 � � � � � �
 � � � �;
 � �}
 � �tmpl-setlooptable_data, table_data;

Its possible to use "setloop" without MySQL, too.

I have created a navigation like this:

Code: [Select]
?php
navigation_links = array
 �0 = array
 � aktiv = 0,
 � nav_punkt = die letzten f�nf,
 � url = gb_top5
 �,
 �1 = array
 � aktiv = 0,
 � nav_punkt = neuer Eintrag,
 � url = gb_neu
 �
;

switch navigation1
{
 �case top5
 � navigation_links0aktiv = 1;
 �break;
 �case neu
 � navigation_links1aktiv = 1;
 �break;
 �default
 � // bei gb_xy liefert der require_once |...| navigation1 einen Fehler
 � navigation1 = intro;
}
?

and I can use it with vlibTemplate.

I create my main site with:
include header.php;
include body.php;
include  navigation[0] . navigation[1] . .php //content
include footer.php;

A complete different approach is possible, too. You can use
Code: [Select]
tmpl_include file=doctype_header.htm
tmpl_include file=body.htm
tmpl_include file={varcontent}
tmpl_include file=footer.htm
instead.

Please read Modular programming with TMPL_INCLUDE for further information.

Regards,
Claus
Last Edit: Mon, 29. May 2006 - 14:33:02 by ClausVB

Solaris

  • Guest
Navigation with vLIB
Reply #3 on: Thu, 22. December 2005 - 15:30:32
thanks The examples helped a lot. I figured it out.

CU
Solaris