Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Create a categories menu  (Read 2495 times)

0 Members and 1 Guest are viewing this topic.

AzorMachine

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 29
Create a categories menu
« on: September 06, 2011, 04:48:06 pm »

I wanna create a vertical menu that contains all of the categories of my gallery. Any code tips?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Create a categories menu
« Reply #1 on: September 06, 2011, 05:08:18 pm »

You need to query the database to get the categories. Something like
Code: [Select]
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_CATEGORIES']}");
$categories = cpg_db_fetch_rowset($rowset);
mysql_free_result($result);
should return you the whole categories table.
Logged

AzorMachine

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 29
Re: Re: Create a categories menu
« Reply #2 on: September 06, 2011, 05:10:02 pm »

You need to query the database to get the categories. Something like
Code: [Select]
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_CATEGORIES']}");
$categories = cpg_db_fetch_rowset($rowset);
mysql_free_result($result);
should return you the whole categories table.

And how can I call it, if the template base is an .html file, and don't supports php?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Create a categories menu
« Reply #3 on: September 06, 2011, 05:11:14 pm »

I suggest that you start to read the docs now to understand how the template system works in Coppermine.
Logged

AzorMachine

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 29
Re: Re: Create a categories menu
« Reply #4 on: September 07, 2011, 09:05:38 pm »

You need to query the database to get the categories. Something like
Code: [Select]
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_CATEGORIES']}");
$categories = cpg_db_fetch_rowset($rowset);
mysql_free_result($result);
should return you the whole categories table.

Ok, that way the categories table is stocked. How to 'echo' it? How would stay the php code?

Best Regards
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Create a categories menu
« Reply #5 on: September 07, 2011, 09:31:22 pm »

Something like
Code: (http://de2.php.net/manual/en/control-structures.foreach.php) [Select]
foreach ($categories as $key => $category) echo $category['name']should work (not tested).
Logged

AzorMachine

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 29
Re: Create a categories menu
« Reply #6 on: September 08, 2011, 03:18:16 pm »

Did this using html to show an static categories menu. No problem at all as there won't be a new categorie.
Thanks for the help.
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 19 queries.