Jump to content

Recommended Posts

Ay all, recently i created a directory (Here) and i have asked on their "Support" forums with no reply if this can be done...

 

What I'd like to do.. is hide the table "Links" if there's none there to be shown instead of having "There are no links here" I myself don't know how to do this but what i have noticed is if you don't have any categories it doesn't show up the table... just wanting the same thing to happen with the links table... I'm using OpenLD btw

 

Any Ideas?

 

This is whats in the index.php file.. it mite help..

 

<?php

/***********************************************************************

  Copyright (C) 2006-2007  Anders Persson (anders_persson@home.se)

  OpenLD is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  OpenLD is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

************************************************************************/

define('OPENLD_ROOT', './');
require OPENLD_ROOT.'header.php';

$page = 'index.php';
($hook = get_hook('index_default_page')) ? eval($hook) : null; //don't load default index if there's no need

if($page == 'index.php')
{
//set the gets
$req_id = isset($_GET['id']) ? $_GET['id'] : 0;
$req_cat = isset($_GET['category']) ? $_GET['category'] : 'root';
$req_page = isset($_GET['page']) ? $_GET['page'] : '1';

//Get category description and perhaps also other info
$query = array(
	'SELECT' => 'description',
	'FROM' => 'categories',
	'WHERE' => 'id='.intval($req_id)
);
($hook = get_hook('category_sql')) ? eval($hook) : null;
$category_result = $db->query_build($query) or error("", __FILE__, __LINE__, $db->error());
$category_result = $db->fetch_row($category_result);

//Dig for categories
$query = array(
	'SELECT' => 'id, title',
	'FROM' => 'categories',
	'WHERE' => 'father_id='.intval($req_id). OPENLD_IF_ACTIVE_CATS,
	'ORDER BY' => $settings['categories_sorting_by']
);
($hook = get_hook('categories_sql')) ? eval($hook) : null;
$categories_result = $db->query_build($query) or error("", __FILE__, __LINE__, $db->error());

//Dig for links
$query = $limit_query = array(
	'SELECT' => '*',
	'FROM' => 'links',
	'WHERE' => 'category_id=' .intval($req_id). ' AND payment_status<>"no"' .OPENLD_IF_ACTIVE_LINKS
);
($hook = get_hook('index_links_sql')) ? eval($hook) : null;
$link_result = $db->query_build($query) or error("can't dig links", __FILE__, __LINE__, $db->error());

//Limit data
$link_limit = $settings['number_of_links_per_page'];
$limit_query['ORDER BY'] = 'type DESC, ' .$settings['links_sorting_by'];
$limit_query['LIMIT'] = $link_limit * ($req_page-1). ', ' .$link_limit;

($hook = get_hook('index_links_sql_limit')) ? eval($hook) : null;
$link_result_limit = $db->query_build($limit_query) or error("can't dig categories with result_limit", __FILE__, __LINE__, $db->error());
}

($hook = get_hook('index_head_page')) ? eval($hook) : null;

require OPENLD_ROOT.'footer.php';

?>

Link to comment
https://forums.phpfreaks.com/topic/72956-regarding-os-directory/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.