ERROR in file ..\components\com_namestreet\views\public.html.php line 42Cannot redeclare class publicNstreetC
public function streets() { $elxis = eFactory::getElxis(); $eLang = eFactory::getLang(); $pathway = eFactory::getPathway(); $eDoc = eFactory::getDocument(); $rows = $this->model->fetchNamestreet(); $pathway->deleteAllNodes(); $pathway->addNode('namestreet', 'namestreet:/'); $pathway->addNode($eLang->get('NAMESTREET')); $eDoc->setTitle($eLang->get('NAMESTREET').' - namestreet'); $eDoc->addStyleLink($elxis->secureBase().'/components/com_namestreet/includes/css/namestreet'.$eLang->getinfo('RTLSFX').'.css'); $eDoc->addScriptLink($elxis->secureBase().'/components/com_namestreet/includes/namestreet.js'); $this->view->streetsHTML(); }
public function fetchNamestreet() { $sql = "SELECT * FROM ".$this->db->quoteId('#__namestreet')." ORDER BY ".$this->db->quoteId('ordering')." ASC"; $stmt = $this->db->prepare($sql); $stmt->execute(); $rows = $stmt->fetchAll(PDO::FETCH_OBJ);foreach ($rows.......εδώ δεν ξέρω....fetchResult(); }
Διαχείριση > Ρυθμίσεις > Καρτέλα "Σφάλματα" > Αναφορά = Σημειώσεις Κάνε αποθήκευση, τώρα θα βλέπεις όλα τα σφάλματα στον browser. Αυτό μόνο για τοπικά site. Σε online site το βάζουμε σε Εκτός και αντ αυτού ενεργοποιούμε την καταγραφή σφαλμάτων.
Αφού ενεργοποιήσεις τα σφάλματα πήγαινε πάλι στην συγκεκριμένη σελίδα που δεν βλέπεις τίποτα. Τώρα θα δεις μία προειδοποίηση ότι η μεταβλητή $eLang δεν έχει οριστεί (για την ακρίβεια είναι ένα instance ενός object που δεν υπάρχει).
/*********************//* LIST STREETS HTML *//*********************/public function streets() { $elxis = eFactory::getElxis(); $eLang = eFactory::getLang(); echo '<h2>'.$eLang->get('NAME_STREETS')."</h2>\n"; elxisLoader::loadFile('includes/libraries/elxis/grid.class.php'); $grid = new elxisGrid('lstreets', $eLang->get('NAME_STREETS')); $grid->setOption('url', $elxis->makeAURL('namestreet:streets/getstreets.xml', 'inner.php')); $grid->setOption('sortname', 'level'); $grid->setOption('sortorder', 'desc'); $grid->setOption('rp', $elxis->getCookie('rp', 10)); $grid->setOption('showToggleBtn', false); $grid->setOption('singleSelect', true); $grid->addColumn($eLang->get('ID'), 'id', 60, true, 'center'); $grid->addColumn($eLang->get('NAME'), 'title', 160, true, 'left'); $grid->addColumn($eLang->get('DESCRIPTION'), 'description', 350, false, 'auto'); $grid->addColumn($eLang->get('PUBLISHED'), 'published', 80, false, 'center'); $grid->addButton($eLang->get('NEW'), 'addname', 'add', 'nameaction'); $grid->addSeparator(); $grid->addButton($eLang->get('EDIT'), 'editname', 'edit', 'nameaction'); $grid->addSeparator(); $grid->addButton($eLang->get('DELETE'), 'deletename', 'delete', 'nameaction'); $grid->addSeparator();?> <script type="text/javascript"> /* <![CDATA[ */ function nameaction(task, grid) { if (task == 'addname') { var newurl = '<?php echo $elxis->makeAURL('namestreet:streets/edit.html'); ?>?id=0'; location.href = newurl; } else if (task == 'editname') { var nsel = $('.trSelected', grid).length; if (nsel < 1) { alert('<?php echo addslashes($eLang->get('NO_ITEMS_SELECTED')); ?>'); return false; } else { var newurl = '<?php echo $elxis->makeAURL('namestreet:streets/edit.html'); ?>?id='; var items = $('.trSelected',grid); var groupid = parseInt(items[0].id.substr(3)); newurl += groupid; location.href = newurl; } } else if (task == 'deletename') { var nsel = $('.trSelected', grid).length; if (nsel < 1) { alert('<?php echo $eLang->get('NO_ITEMS_SELECTED'); ?>'); return false; } else { if (confirm('<?php echo addslashes($eLang->get('AREYOUSURE')); ?>')) { var items = $('.trSelected',grid); var groupid = parseInt(items[0].id.substr(3)); var edata = {'id': groupid}; var eurl = '<?php echo $elxis->makeAURL('namestreet:streets/deletename', 'inner.php'); ?>'; var successfunc = function(xreply) { var rdata = new Array(); rdata = xreply.split('|'); var rok = parseInt(rdata[0]); if (rok == 1) { $("#lstreets").flexReload(); } else { alert(rdata[1]); } } elxAjax('POST', eurl, edata, null, null, successfunc, null); } } } else { alert('Invalid request!'); } } /* ]]> */ </script> <?php $grid->render(); unset($grid); }
<?php /*** @version 1.0* @package Component Name Street* @author Write your name* @copyright Write some copyright text* @license Elxis Public License (https://www.elxis.org/elxis-public-license.html)* @description Name Street component******************************************/defined('_ELXIS_') or die ('Direct access to this location is not allowed');class adminNstreetV extends nstreetView { /*********************/ /* MAGIC CONSTRUCTOR */ /*********************/ public function __construct() { parent::__construct(); } /**********************/ /* CONTROL PANEL HTML */ /**********************/ public function apanelHTML() { $elxis = eFactory::getElxis(); $eLang = eFactory::getLang(); $link = $elxis->makeAURL('namestreet:streets.html'); echo '<h2>'.$eLang->get('NAME_STREETS')."</h2>\n"; } /*********************/ /* LIST STREETS HTML */ /*********************/ public function streets() { $elxis = eFactory::getElxis(); $eLang = eFactory::getLang(); $link = $elxis->makeAURL('namestreet:edit.html').'?id=0'; echo '<h2>'.$eLang->get('NAME_STREETS')."</h2>\n"; elxisLoader::loadFile('includes/libraries/elxis/grid.class.php'); $grid = new elxisGrid('lstreets', $eLang->get('NAME_STREETS')); $grid->setOption('url', $elxis->makeAURL('namestreet:streets/getstreets.xml', 'inner.php')); $grid->setOption('sortname', 'level'); $grid->setOption('sortorder', 'desc'); $grid->setOption('rp', $elxis->getCookie('rp', 10)); $grid->setOption('showToggleBtn', false); $grid->setOption('singleSelect', true); $grid->addColumn($eLang->get('ID'), 'id', 60, true, 'center'); $grid->addColumn($eLang->get('NAME'), 'title', 160, true, 'center'); $grid->addColumn($eLang->get('DESCRIPTION'), 'description', 350, false, 'auto'); $grid->addColumn($eLang->get('PUBLISHED'), 'published', 80, false, 'center'); $grid->addButton($eLang->get('NEW'), 'addname', 'add', 'nameaction'); $grid->addSeparator(); $grid->addButton($eLang->get('EDIT'), 'editname', 'edit', 'nameaction'); $grid->addSeparator(); $grid->addButton($eLang->get('DELETE'), 'deletename', 'delete', 'nameaction'); $grid->addSeparator();?> <script type="text/javascript"> /* <![CDATA[ */ function nameaction(task, grid) { if (task == 'addname') { var newurl = '<?php echo $elxis->makeAURL('namestreet:streets/edit.html'); ?>?id=0'; location.href = newurl; } else if (task == 'editname') { var nsel = $('.trSelected', grid).length; if (nsel < 1) { alert('<?php echo addslashes($eLang->get('NO_ITEMS_SELECTED')); ?>'); return false; } else { var newurl = '<?php echo $elxis->makeAURL('namestreet:streets/edit.html'); ?>?id='; var items = $('.trSelected',grid); var nameid = parseInt(items[0].id.substr(3)); newurl += nameid; location.href = newurl; } } else if (task == 'deletename') { var nsel = $('.trSelected', grid).length; if (nsel < 1) { alert('<?php echo $eLang->get('NO_ITEMS_SELECTED'); ?>'); return false; } else { if (confirm('<?php echo addslashes($eLang->get('AREYOUSURE')); ?>')) { var items = $('.trSelected',grid); var nameid = parseInt(items[0].id.substr(3)); var edata = {'id': nameid}; var eurl = '<?php echo $elxis->makeAURL('namestreet:streets/deletename', 'inner.php'); ?>'; var successfunc = function(xreply) { var rdata = new Array(); rdata = xreply.split('|'); var rok = parseInt(rdata[0]); if (rok == 1) { $("#lstreets").flexReload(); } else { alert(rdata[1]); } } elxAjax('POST', eurl, edata, null, null, successfunc, null); } } } else { alert('Invalid request!'); } } /* ]]> */ </script> <?php $grid->render(); unset($grid); } /********************/ /* EDIT STREET HTML */ /********************/ public function editStreetHTML($row) { $elxis = eFactory::getElxis(); $eLang = eFactory::getLang(); $clang = $elxis->getConfig('LANG'); $cinfo = $eLang->getallinfo($clang); $action = $elxis->makeAURL('namestreet:save.html', 'inner.php'); elxisLoader::loadFile('includes/libraries/elxis/form.class.php'); $formOptions = array( 'name' => 'nseditform', 'action' => $action, 'idprefix' => 'ens', 'label_width' => 140, 'label_align' => 'left', 'label_top' => 0, 'tip_style' => 1, 'jsonsubmit' => 'document.nseditform.submit()' ); $form = new elxisForm($formOptions); $trdata = array('title' => 'com_namestreet', 'element' => 'title', 'elid' => intval($row->id)); $form->addMLText('title', $trdata, $row->title, $eLang->get('TITLE'), array('required' => 1, 'size' => 45, 'maxlength' => 180)); $form->addYesNo('published', $eLang->get('PUBLISHED'), $row->published); $trdata = array('category' => 'com_namestreet', 'element' => 'description', 'elid' => (int)$row->id); $form->addMLTextarea( 'description', $trdata, $row->description, $eLang->get('DESCRIPTION'), array('cols' => 80, 'rows' => 8, 'forcedir' => $cinfo['DIR'], 'editor' => 'html', 'contentslang' => $clang) ); $form->addHidden('id', $row->id); $form->render(); }}?>