Comments (6)
You can try to use msProducts as replacement for getResources.
Later i want to include this functionality in pdoTools.
from pdotools.
By the way, here is possible config options.
You can look in methods, how they used in class.
I have documentation for pdoTools, but it on russian and availible only for my paid subscribers.
from pdotools.
Hi,
thanks for the reply, tried a bit around with some additional config options and was a bit more successful (at least getting the resources in an array and can do something with them, not much yet, but better than nothing=D)
Would love to pay that 300 rubels to get more info about pdoTools, I have signed in, but cannot make that payment because google has troubles translating the pages when I'm logged + z-payment/qiwi dont let me do anything (z-payment bc russian only and qiwi because switzerland ist not on the supported country list). Any possibility that I pay the 300 rubles per paypal and can somehow access that pdoTools documentation / that article here Самые быстрые сниппеты с pdoTools http://bezumkin.ru/sections/php/556/
I have the following now:
<?php
$pdoFetch = $modx->getService('pdofetch','pdoFetch', MODX_CORE_PATH.'components/pdotools/model/pdotools/');
if ( $pdoFetch instanceof pdoFetch ) {
$pdoFetch->config['tpl'] = 'article.teaser';
$pdoFetch->config['return'] = 'data'; // this was necessary to get back an array
$pdoFetch->config['fastMode'] = 1; // doesn't matter if I put 0 or 1 there, the placeholders with output filters don't get processed
$pdoFetch->config['includeTVs'] = 1; // maybe related, but I don't see any tv data if I print_r the single resources
//$pdoFetch->config['includeTVList'] = 'article.teaser.title,article.teaser.img,article.img.full,team-img,team-job'; // this gives me some sql syntax error
//$pdoFetch->config['tvsSelect'] = array('article.teaser.title'); // same here
echo '<pre>' . print_r($pdoFetch->config,1) . '</pre>';
$rows = $pdoFetch->run();
if (!empty($rows) && is_array($rows)) {
//echo 'rows is array';
foreach ($rows as $row) {
//echo '<pre>' . print_r($row,1) . '</pre>';
echo $pdoFetch->getChunk($pdoFetch->config['tpl']);
//echo $row['pagetitle'];
//var_dump($row);
}
}
//var_dump($rows);
}
and the tpl chunk is:
<article class="col teaser">
<section class="teaserwrap">
<figure>
[[+article.teaser.img:isnot=``:then=`<img src="[[+article.teaser.img]]" alt="" />`:else=`[[+article.img.full:isnotempty=`<img src="[[+article.img.full]]" alt="" />`]][[+team-img:isnotempty=`<img src="[[+team-img]]" alt="" />`]]`]]
<figcaption class="hoverlay border-box">
</figcaption>
</figure>
<hgroup>
<h3><a href="[[~[[+id]]]]" class="biggie">[[+article.teaser.title:default=`[[+pagetitle:limit=`44`]]`]]</a></h3>
<h6 class="claim">[[+article.teaser.claim:default=`[[+longtitle:isnotempty=`[[+longtitle:limit=`26`]]`]][[+team-job:isnotempty=`[[+team-job:limit=`26`]]`]]`]]</h6>
</hgroup>
</section>
</article>
this gives me just output like this:
[[+article.teaser.img:isnot=``:then=``:else=`[[+article.img.full:isnotempty=``]][[+team-img:isnotempty=``]]`]]
[[+article.teaser.title:default=`[[+pagetitle:limit=`44`]]`]]
[[+article.teaser.claim:default=`[[+longtitle:isnotempty=`[[+longtitle:limit=`26`]]`]][[+team-job:isnotempty=`[[+team-job:limit=`26`]]`]]`]]
so the 2 main question are:
- how do I include TV's correctly so they can be parsed by getChunk()
and
- if not with fastMode=
1
or0
, how to get pdoFetch to parse placeholders with output filters?
from pdotools.
You do not send data to getChunk!
if (!empty($rows) && is_array($rows)) {
foreach ($rows as $row) {
//echo '<pre>'; print_r($row); die; // this will print the whole fields of row and exit
echo $pdoFetch->getChunk($pdoFetch->config['tpl'], $row); // You forgot to send $row into the method
}
}
If you want, you can manually send me $10 to PayPal ([email protected]), then send a letter (with your credentials on my site) and i will open access to your account for a month.
- TVs including by
&includeTVs=`tvname,othertvname,etc`.
Also you can use &tvPrefix=, it is blank by default.
- Fast mode will cut all unprocessed placeholders with filters. It is need only if you receive all needed data from tables and prepare it manually. And it works very fast, becouse do not use tags processing.
from pdotools.
Hi,
thanks again for the response! Just sent you the 10$ via paypal!
tried your suggestion with includeTVs but wasn't successful, could i t be a problem to have dots (.) in tv names somehow? Because I get
[pdoTools] Error 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.contentid=modResource.id AND TVarticle.img.full.tmplvarid=17 LEFT JOIN `modx_si' at line 1
when I run this in Console
<?php
$pdoFetch = $modx->getService('pdofetch','pdoFetch', MODX_CORE_PATH.'components/pdotools/model/pdotools/');
if ( $pdoFetch instanceof pdoFetch ) {
$pdoFetch->config['tpl'] = 'article.teaser';
$pdoFetch->config['return'] = 'data'; // this was necessary to get back an array
$pdoFetch->config['fastMode'] = 0; // doesn't matter if I put 0 or 1 there, the placeholders with output filters don't get processed
$pdoFetch->config['includeTVs'] = 'article.teaser.title,article.teaser.img,article.img.full,team-img,team-job'; // maybe related, but I don't see any tv data if I print_r the single resources
//$pdoFetch->config['includeTVList'] = 'team-img,team-job'; // this gives me some sql syntax error
//$pdoFetch->config['tvsSelect'] = array('article.teaser.title'); // same here
echo '<pre>' . print_r($pdoFetch->config,1) . '</pre>';
$rows = $pdoFetch->run();
if (!empty($rows) && is_array($rows)) {
//echo 'rows is array';
foreach ($rows as $row) {
//echo '<pre>' . print_r($row,1) . '</pre>';
echo $pdoFetch->getChunk($pdoFetch->config['tpl'], $row);
//echo $row['pagetitle'];
//var_dump($row);
}
}
//var_dump($rows);
}
and if I remove the TVs with dots in their names (leaving just team-img and team-job) I get this error
[pdoTools] Error 42S22: Unknown column 'TVteam' in 'on clause'
from pdotools.
Of course, remove the point, they break SQL query.
Access granted. Please, write me futher comments on my site.
from pdotools.
Related Issues (20)
- pdoPage: Undefined variable $showLog HOT 3
- (ERROR @ /home/s30946/www/core/components/pdotools/model/pdotools/pdotools.class.php : 999) Unexpected token 'match' in expression
- MODX Revolution 3.0.2 + pdoTools 3.0.1 / showLog doesn't work
- &outputSeparator + ajax technology don't work correctly
- Fatal error при включенной опции pdotools_fenom_cache
- issue with pdoPage snippet of pdoTools component
- [Fenom] Не корректно работает $.tpl.name HOT 7
- Return an array of raw data (it is necessary when using the Fenom template engine). HOT 1
- includeContent doesn't work when not logged in [pdoResources]
- pdoCrumbs issue
- pdoResources ломается, если нет поля для сортировки
- pdoMenu - active class not set correctly with weblinks
- Incorrect Friendly URLs with pagination when using pdoPage
- The showLog change has to be documented somewhere
- Bug PHP 8 pdoResources snippet with property 'toSeparatePlaceholders' in combination with pdoPage HOT 1
- Добавить параметр &limitOnPage для pdoPage
- pdoMenu не возвращает данные по параметрам
- Fatal error: Allowed memory
- >=php 8.3 - decrement on type null
- Static Plugins trigger pdoToolsOnFenomInit even if not defined as their Event
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdotools.