Everything posted by sobrenome
-
flag \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS not working
This is my select: {{$limit = 20;}} {{$page = (isset( \IPS\Request::i()->page ) and (intval( \IPS\Request::i()->page ) > 0)) ? \IPS\Request::i()->page : 1;}} {{$start = ( $limit * ( $page - 1 ) );}} {{$select = \IPS\Db::i()->select( 'cms_custom_database_8.field_68 as nome_do_suplemento, cms_custom_database_8.record_image_thumb as imagem, cms_custom_database_8.primary_id_field as id_do_suplementos, cms_custom_database_8.member_id as autor, cms_custom_database_8.record_updated as data_de_atualizacao, cms_custom_database_8.record_comments as numero_de_comentarios', 'cms_custom_database_8', array( 'field_140=?', $record->primary_id_field ), 'cms_custom_database_8.field_68 ASC', array( $start, $limit ), NULL, NULL, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS );}} {{$total = count( $select );}} Total should be 64, but it gives me 20, the number of rows used as query LIMIT.
-
WhatsApp Share Link
-
[4.2.3] Breadcrumb JSON empty?
Is there a guide for this? I have a database for medical drugs and Pages uses article type schema. I would like to use the specific drug schema: https://schema.org/Drug I have tried: {{\IPS\Output::i()->jsonLd['Drug']['activeIngredient'] = $record->_title;}} But the result is incorrect: <script type='application/ld+json'> { "activeIngredient": "Fenilpropionato de nandrolona" } </script>
-
Suggestions for improvement on Schema.org tags for Pages
-
Structured Data OG and Schema.org
Maybe you can use it like this:
-
Pages record images
Where can I see all the record images uploaded using Pages? And when a record from the Pages database is deleted is the record image also deleted?
-
Recommend Usage of Amazon S3?
How do you backup s3 files?
-
Recommend Usage of Amazon S3?
And the replication bucket has a copy only rule or a sync rule? If it is sync, if a file is deleted from the main bucket it will also be deleted from the replica. I was searching for the s3 versioning behavior and I have seen that when a file is deleted with versioning turned on, the file is not actually deleted from s3, there is a "version delete note" that can be deleted to restore the file. I still have to check, in real life, what happens when an admin or member IPS account deletes a file. If it will be retain as described above or if it will be actually deleted. If the file is not actually deleted, there is already a security layer against abusive deletion by adminCP account on IPS, and the files can be restored. No need for replication, as long as S3 has multiple files along AZs. Am I right?
-
Recommend Usage of Amazon S3?
Cloudflare does the https certificate validation in the case described, right? The user’s browser will get the file from http://cdn.YOURDOMAIN.com and the ssl translation will be made by Cloudflare right? The files are pushed from s3 to cloudflare’s pops and the user will get the file from cloudflare, not from s3, right?
-
Recommend Usage of Amazon S3?
So far o good. If I do not use dots in bucket name, how could I use Cloudflare and S3?
-
Recommend Usage of Amazon S3?
Just the same permissions: I am using Cloudflare, so I set a subdomain for the bucket on Cloudflare: CNAME record name: cdn destination: cdn.YOURDOMAIN.COM.s3.sa-east-1.amazonaws.com On AWS: bucket name: cdn.YOURDOMAIN.COM On IPS: bucket: cdn.YOURDOMAIN.COM endpoint: s3.sa-east-1.amazonaws.com custom URL: //cdn.YOURDOMAIN.COM Remember to use the proper region of your bucket. I would like to know how are you dealing with data security. S3 is very reliable and do not need a backup as long there is an auto AWS replication of the data. But what if someone hacks the community AdminCP account and delete all files? Everything will be delete on S3. Anyone is using S3 replication to another AWS account to secure the data? Is there any better solution?
-
Pages select field: how to get the key in database
I am using select field type in Pages to store in the database integers from 0 to 5 as a rating system. How do I get this values in the template. I am trying something like this: {{if $record->$field_165 == 0}} {$estrela_0|raw} {{elseif $record->$field_165 == 1}} {$estrela_1|raw} {{elseif $record->$field_165 == 2}} {$estrela_2|raw} {{elseif $record->$field_165 == 3}} {$estrela_3|raw} {{elseif $record->$field_165 == 4}} {$estrela_4|raw} {{elseif $record->$field_165 == 5}} {$estrela_5|raw} {{endif}} What I need is the content stored on the database for the field_165.
-
Combine ->first() and ->join() on database query
There are results. I have changed the query to limit it to one row instead of using ->first(); {{$select = \IPS\Db::i()->select( 'cms_custom_database_12.field_142 as preco, cms_custom_database_12.field_154 as link, cms_custom_database_12.record_updated as atualizado, cms_custom_database_13.field_143 as loja, cms_custom_database_13.record_image_thumb as logo, cms_custom_database_13.field_160 as cupom, cms_custom_database_13.field_161 as cupom_valor, cms_custom_database_13.primary_id_field as loja_ID', 'cms_custom_database_12', array( array( 'field_156=?', $row->primary_id_field ), array( 'field_141=?', 1 ) ), 'cms_custom_database_12.field_142 ASC', 1)->join( 'cms_custom_database_13', 'cms_custom_database_13.primary_id_field=field_155', 'INNER' );}}
-
Combine ->first() and ->join() on database query
It does not work. An error is prompted: UnderflowException: (0) #0 /var/www/html/applications/cms/sources/Theme/Theme.php(610) : eval()'d code(1214): IPS\Db\_Select->first() #1 /var/www/html/applications/cms/sources/Theme/Theme.php(610) : eval()'d code(697): IPS\Theme\class_cms_database_suplementos_record_listing_4_5->recordRow() #2 /var/www/html/system/Helpers/Table/Table.php(564): IPS\Theme\class_cms_database_suplementos_record_listing_4_5->categoryTable() #3 /var/www/html/applications/cms/modules/front/database/category.php(697): IPS\Helpers\Table\_Table->__toString() #4 /var/www/html/applications/cms/modules/front/database/index.php(48): IPS\cms\modules\front\database\_category->view() #5 /var/www/html/system/Dispatcher/Controller.php(101): IPS\cms\modules\front\database\_index->manage() #6 /var/www/html/applications/cms/sources/Databases/Dispatcher.php(327): IPS\Dispatcher\_Controller->execute() #7 /var/www/html/system/Theme/Theme.php(4481) : eval()'d code(9): IPS\cms\Databases\_Dispatcher->run() #8 /var/www/html/applications/cms/sources/Pages/Page.php(1261): IPS\Theme\content_pages_55() #9 /var/www/html/applications/cms/sources/Pages/Page.php(2266): IPS\cms\Pages\_Page->getHtmlContent() #10 /var/www/html/applications/cms/modules/front/pages/page.php(116): IPS\cms\Pages\_Page->output() #11 /var/www/html/applications/cms/modules/front/pages/page.php(43): IPS\cms\modules\front\pages\_page->view() #12 /var/www/html/system/Dispatcher/Controller.php(101): IPS\cms\modules\front\pages\_page->manage() #13 /var/www/html/applications/cms/modules/front/pages/page.php(33): IPS\Dispatcher\_Controller->execute() #14 /var/www/html/system/Dispatcher/Dispatcher.php(152): IPS\cms\modules\front\pages\_page->execute() #15 /var/www/html/index.php(13): IPS\_Dispatcher->run() #16 {main} The query: {{$select = \IPS\Db::i()->select( 'cms_custom_database_12.field_142 as preco, cms_custom_database_12.field_154 as link, cms_custom_database_12.record_updated as atualizado, cms_custom_database_13.field_143 as loja, cms_custom_database_13.record_image_thumb as logo, cms_custom_database_13.field_160 as cupom, cms_custom_database_13.field_161 as cupom_valor, cms_custom_database_13.primary_id_field as loja_ID', 'cms_custom_database_12', array( array( 'field_156=?', $row->primary_id_field ), array( 'field_141=?', 1 ) ), 'cms_custom_database_12.field_142 ASC')->join( 'cms_custom_database_13', 'cms_custom_database_13.primary_id_field=field_155', 'INNER' )->first();}}
-
Combine ->first() and ->join() on database query
I am running this database query: {{$select = \IPS\Db::i()->select( 'cms_custom_database_12.field_142 as preco, cms_custom_database_12.field_154 as link, cms_custom_database_12.record_updated as atualizado, cms_custom_database_13.field_143 as loja, cms_custom_database_13.record_image_thumb as logo, cms_custom_database_13.field_160 as cupom, cms_custom_database_13.field_161 as cupom_valor, cms_custom_database_13.primary_id_field as loja_ID', 'cms_custom_database_12', array( array( 'field_156=?', $row->primary_id_field ), array( 'field_141=?', 1 ) ), 'cms_custom_database_12.field_142 ASC')->join( 'cms_custom_database_13', 'cms_custom_database_13.primary_id_field=field_155', 'INNER' );}} I would like to get just the first row, I do not want to loop over all results. How to use ->first() in this query?
-
How to get record_image on database category row template
It is a new template based on the built in category listing templates, the categoryRow template to be more specific.
-
How to get record_image on database category row template
I am customising the category row template and I would like to present the last post along with the record_image, not only title and date. How to get the last post record image on database category row template?
-
Remove data-controller for child element
It was my bad. My HTML code was incorrect. Now that HTML 5 standard is ok, the parent data-controller is not affecting the child. Thanks! 🙈
-
Is member admin?
In Pages templates, how to check if logged member is admin?
-
Remove data-controller for child element
Is there a way to remove the parent HTML element data-controller JS on a child HTML element?
-
How to allow data-attribute in posts?
Is there a guide for available data-controller?
-
How to get a Pages record URL by ID?
Thanks!
-
How to get a Pages record URL by ID?
I am working on a Pages template and I want to get the URL of a record of another database. To get the URL of the current database I am using this code: {{$url = \IPS\Http\Url::internal( "app=cms&module=pages&controller=page&path=" . \IPS\cms\Pages\Page::loadByDatabaseId( $record->database()->id )->full_path, 'front', 'content_page_path' );}} And how to get the URL of a record from another database using the record primary id field?
-
Pages: how to get the ID of the record on template
Perfect, I guess caching was the reason it did not work before.
-
Pages: how to get the ID of the record on template
How to get the ID of the record on Pages templates? I have tried: $record->id $record->_id $record->primary_id_field