Seite 1 von 1

eigene codingversuche

Verfasst: 08.08.2004 02:15
von Lord_Femto
hallo. ich möchte nun etwas coden, was mir sehr schwierig erscheint. ich möchte damit meist über mysql arbeiten. außerdem möchte ich ein template system nutzen. worauf musss ich achten?

hier meine ersten versuche.

erst einmal die datenbanken (ca. wie sie aussehen sollen)

1. Tabelle (inu_home_categories)

cat_id | categories
-------------------------
1 | Inuyasha
2 | Fanwork
3 | Community
4 | Downloads
5 | Seite intern

2. Tabelle (inu_home_content)

cat_id | con_id | content | link
----------------------------------------
1 | 1 | News | news.php
1 | 2 | Story | story.php
3 | 1 | Forum | forum/index.php

nun wollte ich also die linke helfte der navigation kreieren. und so ähnlich wie auf www.inuyasha.de sollte es dann links aussehen.
doch es erweist sich als ziemlich schwieriges unterfangen.

hier mein script (ich versuche etwas auf phpbb basis zu coden):

Code: Alles auswählen

<?php

define('IN_INU', true);
$inu_root_path = './';
include($inu_root_path . 'extension.inc');
include($inu_root_path . 'common.'.$phpEx);

include($inu_root_path . 'includes/page_header.'.$phpEx);

$template->set_filenames(array(
	'body' => 'left_site_body.tpl')
);

$sql = "SELECT cat_id, categories, con_id, content, link 
	FROM " . HOME_CATEGORIES_TABLE . " hc, " . HOME_CONTENT_TABLE . " hc2
	WHERE hc.cat_id = hc2.cat_id 
	GROUP BY hc.categories, hc2.content, hc2.link
	ORDER BY hc2.cat_id";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query left_site informations', '', __LINE__, __FILE__, $sql);
}

while( $row = $db->sql_fetchrow($result) )
{
	$categories = $row['hc.categories'];
	$content = '<a href="' . append_sid($row['hc2.link'])'">'$row['hc2.content']'</a>';
	
	$template->assign_block_vars('faq_block.faq_row', array(
		'LEFT_CATEGORIES' => $categories,
		'LEFT_CONTENT' => $content)
	);

}
$db->sql_freeresult($result);


$template->pparse('body');

include($inu_root_path . 'includes/page_tail.'.$phpEx);

?>
ausgabe:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in c:\homepage\server\left_site.php on line 38
wo liegt denn da der fehler

soweit habe ich auch alles beachtet. einige include dateien erstellt. darunter auch constants.php

ist es überhaupt günstig es alles über die sql tabelle zu machen?

Verfasst: 08.08.2004 09:56
von PhilippK
Das stimmt wohl nicht:

Code: Alles auswählen

   $content = '<a href="' . append_sid($row['hc2.link'])'">'$row['hc2.content']'</a>'; 
Änder das mal in

Code: Alles auswählen

   $content = '<a href="' . append_sid($row['hc2.link']) . '">' . $row['hc2.content'] . '</a>';
Gruß, Philipp