Jump to content

sobrenome

Clients
  • Posts

    2,525
  • Joined

  • Last visited

 Content Type 

Downloads

Release Notes

IPS4 Guides

IPS4 Developer Documentation

Invision Community Blog

Development Blog

Deprecation Tracker

Providers Directory

Forums

Events

Store

Gallery

Posts posted by sobrenome

  1. 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.

  2. 6 hours ago, IPCommerceFan said:

    Underflow exception would indicate there aren't any results for the query, I've seen.

    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' );}}

     

  3. 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();}}

     

  4. 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?

  5. 1 hour ago, bfarber said:

    Can you clarify what you are after? Parent and child elements can manipulate each other in javascript so I guess the answer to your question may be "yes" but I'm not entirely sure what you are asking specifically.

    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! 🙈

  6. 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?

  7. I have tried to upgrade from 4.4 to 4.5 and could not.

    On AdminCP I get this error:

    SELECT count(mlog_id) FROM `ip_boardcore_mail_error_logs` AS `core_mail_error_logs` WHERE mlog_notification_sent=false
    IPS\Db\Exception: Unknown column 'mlog_notification_sent' in 'where clause' (1054)
    #0 /var/www/html/system/Db/Select.php(383): IPS\_Db->preparedQuery()
    #1 /var/www/html/system/Db/Select.php(441): IPS\Db\_Select->runQuery()
    #2 /var/www/html/system/Db/Select.php(365): IPS\Db\_Select->rewind()
    #3 /var/www/html/system/Email/Email.php(1612): IPS\Db\_Select->first()
    #4 /var/www/html/applications/core/extensions/core/AdminNotifications/ConfigurationError.php(178): IPS\_Email::countFailedMail()
    #5 /var/www/html/applications/core/modules/admin/system/login.php(193): IPS\core\extensions\core\AdminNotifications\_ConfigurationError::runChecksAndSendNotifications()
    #6 /var/www/html/applications/core/modules/admin/system/login.php(104): IPS\core\modules\admin\system\_login->_doLogin()
    #7 /var/www/html/system/Dispatcher/Controller.php(101): IPS\core\modules\admin\system\_login->manage()
    #8 /var/www/html/system/Dispatcher/Dispatcher.php(152): IPS\Dispatcher\_Controller->execute()
    #9 /var/www/html/admin/index.php(14): IPS\_Dispatcher->run()
    #10 {main}

    Is mail_error_logs a table created by Mail Bouncer? My community is offline.

  8. 7 hours ago, christopher-w said:

    We have numerous partner and corporate sites on Cloudflare including 3 WP sites which have been transformed by the reduction in TTFB since we opted in. It’s free too for those already on paid plans.

    Good to know that it works in real life. Hope we have an IPS plugin soon.

×
×
  • Create New...