Some of this might be helpful:
http://bobsguides.com/revolution-objects.html
http://bobsguides.com/custom-db-tables.html
---------------------------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
MODx info for everyone:
http://bobsguides.com/modx.html
opengeek: Thanks!
$dsn = 'mysql:host=mysql.host.cz;dbname=abc;port=3306;charset=utf-8';
$xpdo = new xPDO($dsn,'user','password');
$output = array();
$pdoStmt = $xpdo->prepare("SELECT * FROM category ORDER BY `name` ASC LIMIT 8");
if ($pdoStmt->execute(array($id, $name))) {
while ($row = $pdoStmt->fetch(PDO::FETCH_OBJ)) {
$output[] = "ID: {$row->id} - Name: {$row->name} - Alternativni nazev: {$row->name_alt} - Narazena kategorie: {$row->parent_id} - Zobrazit: {$row->view}
";
}
}
return implode("\n", $output);
works fine
Question:
how make I another "display output" data in table structure?
(And styling (CSS) this table ...)
Bob, Hi!
In the middle January I buy at amazon.com this your book:
Today I receive package !
:-)
Thanks for this book! Nice!
[ed. note: puschpull last edited this post 14 years, 8 months ago.]
Thanks for buying the book.
---------------------------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
MODx info for everyone:
http://bobsguides.com/modx.html
Hi
i have code:
<?php
$query = $modx->newQuery('category');
$query->select($modx->getSelectColumns('category','','',array('id','name')));
$boxes = $modx->getCollection('category',$query);
echo 'Total: '.count($boxes);
on screen:
Total: 0
this i bad
good is
Total: 55
Table "category" is the same
id smallint(4) Auto Increment
name varchar(64)
name_alt varchar(128)
parent_id smallint(4) NULL
view smallint(2) [1]
Here:
http://puschpull.org/modx_rev/galerie1
i tested gallery snippet with "Highslide"
Select in DropDown List Categorii and submit = open thumbnails ets ...
but i have problem with the simplest question in database
(with xPDO /MODx API)
:-(
"normal" PHP code works fine
any ideas ?
Thanks!
You need to add the package eg, the model for it, good resource is the Bob's page directly related to custom tables:
http://bobsguides.com/custom-db-tables.html
Almost retired from web-development industry but still randomly writing at Lazylegs.info and on schedule hopefully in near future to finish Oracle and PostgreSQL ports of MODX
Thanks, but:
i don't understand
I read this page
http://bobsguides.com/custom-db-tables.html
http://bobsguides.com/revolution-objects.html
http://rtfm.modx.com/display/revolution20/Using+Custom+Database+Tables+in+your+3rd+Party+Components
etc ...
but I need help with this simple question
( SELECT id,name,view FROM category WHERE view=1 ORDER BY name DESC LIMIT 16; )
when i understand this, then is all another db queries OK
:-)
Your xpdo query is fine, except missing the view column.
If you don't have the model created from the schema and haven't called the package with $modx->addPackage(); it cannot get results as it wont load the objects for it.
## Edit
<?php
$query = $modx->newQuery('category');
$query->select($modx->getSelectColumns('category','','',array('id','name', 'view')));
$query->sortby('name', 'DESC');
$query->limit(16);
$boxes = $modx->getCollection('category',$query);
echo 'Total: '.count($boxes);
But this does not work if you don't add the package
Almost retired from web-development industry but still randomly writing at Lazylegs.info and on schedule hopefully in near future to finish Oracle and PostgreSQL ports of MODX
Thanks!
I have to learning about creating Package
But my English is very very bad.