Welcome, Guest

404 Seite mit 404 Header ausgeben
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: 404 Seite mit 404 Header ausgeben

404 Seite mit 404 Header ausgeben 2 years, 7 months ago #9191

Ich möchte gerne ein4 404 Fehlerseite ausgeben, wenn bei einer Datenbankabfrage kein Ergebnis gefunden wird. Wie geht´s

Grüße

Christian Teuber
  • teubernet
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 0

Re:404 Seite mit 404 Header ausgeben 2 years, 7 months ago #9192

ok habe die Abfrage mit

global $database;

$rec_id=mosGetParam($_REQUEST, 'ff_param_id', '');

$database->setQuery(
    "select * from haendler ".
    "WHERE `kd` LIKE '$rec_id'"
);

$rows = $database->loadObjectList();

//check for search result
//count number of array elements
$n = count($rows);
if ($n == '') {
//redirect
header("Location: {mossite}/404");
}//if n


einer Abfrage nach Ergebnissen ergänzt und auf eine 404 Seite weitergeleitet. Allerdings wird die Seite per 302 auf die 404 Seite geleitet Siehe hier (am Besten mit Firefox und Firebug betrachten)

Das Ganze soll den Sinn haben, dass veraltete Händler Id´s per 404 aus den Suma´s entfernt werden. Da aber dazwischen per 302 umgeleitet wird wird das wohl nicht funktionieren, besser wäre vermutlich eine 301 Umleitung.

Was kann man machen?

Dank und Gruß

Christian Teuber
  • teubernet
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 0
Last Edit: 2 years, 7 months ago by teubernet.

Re:404 Seite mit 404 Header ausgeben 2 years, 7 months ago #9193

versuch mal das (und nur das)

JError::raiseError('404', 'OMGWTF!');
  • TheMuffinMan

Re:404 Seite mit 404 Header ausgeben 2 years, 7 months ago #9194

wo soll das rein?
  • teubernet
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 0

Re:404 Seite mit 404 Header ausgeben 2 years, 7 months ago #9195

da wo du deine header setzt, also austauschen.

mal ne zwischenfrage, Dein Code sieht nach Joomla 1.0 aus, sicher dass Du das so willst?
  • TheMuffinMan

Re:404 Seite mit 404 Header ausgeben 2 years, 7 months ago #9196

ok, habe gecheckt wo rein

global $database;

$rec_id=mosGetParam($_REQUEST, 'ff_param_id', '');

$database->setQuery(
    "select * from haendler ".
    "WHERE `kd` LIKE '$rec_id'"
);

$rows = $database->loadObjectList();

//check for search result
//count number of array elements
$n = count($rows);
if ($n == '') {
//redirect
JError::raiseError('404', 'OMGWTF!');
}//if n


jetzt kommt aber die Standrd Joomla 404 Seite, hätte aber gerne die "Schöne" 404 Seite die sh404sef generiert.

Dank und Gruß

Christian Teuber
  • teubernet
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 0
  • Page:
  • 1
  • 2
Moderators: TheMuffinMan, ForumSupport
Time to create page: 0.33 seconds

Facebook Discount - 40% Off!

Fans of our Facebook page here are entitled to get a 1-year-subscription for the price of a 6-months!

Steps to take:

  • Become a fan on Facebook (Like) here
  • Purchase a 6-months-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of your like and we'll upgrade to the 1-year-subscription

Joomla!® Forms Discount - 40% Off!

Already purchased a forms extension from a different vendor but your requirements changed and now you need a forms extension that is capable of more than just the standards? We help you to keep the costs for a change under control: Get a 40% discount on our professional membership plan! -- meaning timely unlimited access to all current and future commercial extensions, breezingforms themes & apps and Joomla!® templates at crosstec.de, including 1 year of support -- without any website limitations -- Just prove that you previously purchased another forms extension for Joomla!® from a different vendor and you are qualified.

Steps to take:

  • Purchase a 1-year-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of the purchase for the other form vendor and we'll upgrade to the professional-subscription

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany

Imprint