Created
October 31, 2011 03:55
-
-
Save elinw/1326876 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I put this in a layout | |
jimport('joomla.database.database'); | |
jimport('joomla.database.databasequery'); | |
$this->tablePrefix = ''; | |
$newname = JDatabase::replacePrefix('#__somename'); | |
var_dump($newname); | |
int(0) int(638) int(0) int(638) int(0) int(143) int(0) int(11) string(8) "somename" | |
But how do I normaly get $this->tablePrefix? I shouldn't be entering it by hand, it could be randomly generated like in the cms. I'm not going to know what it is to hard code it! | |
If I take that out | |
I get | |
int(0) int(638) int(0) int(638) int(0) int(143) int(0) int(11) Notice: Undefined property: ContentViewArticles::$tablePrefix in /home/owner/www/db174/libraries/joomla/database/database.php on line 1222 Call Stack: 0.0005 671496 1. {main}() /home/owner/www/db174/administrator/index.php:0 0.0522 8214664 2. JAdministrator->dispatch() /home/owner/www/db174/administrator/index.php:47 0.0557 8800408 3. JComponentHelper::renderComponent() /home/owner/www/db174/administrator/includes/application.php:153 0.0618 8926944 4. require_once('/home/owner/www/db174/administrator/components/com_content/content.php') /home/owner/www/db174/libraries/joomla/application/component/helper.php:156 0.0687 9418880 5. JController->execute() /home/owner/www/db174/administrator/components/com_content/content.php:22 0.0687 9419016 6. ContentController->display() /home/owner/www/db174/libraries/joomla/application/component/controller.php:684 0.0724 9560968 7. JController->display() /home/owner/www/db174/administrator/components/com_content/controller.php:57 0.0809 10735536 8. ContentViewArticles->display() /home/owner/www/db174/libraries/joomla/application/component/controller.php:650 0.0866 11185216 9. JView->display() /home/owner/www/db174/administrator/components/com_content/views/articles/view.html.php:51 0.0866 11185216 10. JView->loadTemplate() /home/owner/www/db174/libraries/joomla/application/component/view.php:180 0.0872 11385920 11. include('/home/owner/www/db174/administrator/components/com_content/views/articles/tmpl/default.php') /home/owner/www/db174/libraries/joomla/application/component/view.php:582 0.0929 12635680 12. JDatabase->replacePrefix() /home/owner/www/db174/administrator/components/com_content/views/articles/tmpl/default.php:20 string(8) "somename" | |
If I add my code to the method I get | |
int(0) int(638) int(0) int(638) int(0) int(143) int(0) int(11) string(8) "somename" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment