Support Forum
Hi, Is it possible to show values that are stored in a custom table that is within wp database? thanks
Hi Toni,
Yes, we can call a PHP function via the proxy mb
in the view. Use this code to show values that are stored in the custom table.
{{mb.rwmb_meta( $field_id, {'storage_type': 'custom_table', 'table': $table_name} )}}
For more information, please follow this documentation https://docs.metabox.io/extensions/mb-views/#running-php-functions.
Hi Long, thanks for your reply, I'm getting this error...?
Fatal error: Uncaught Twig_Error_Syntax: Unexpected character "$" in "obra-single" at line 50. in C:\xampp\www\wp-content\plugins\meta-box-aio\vendor\twig\twig\lib\Twig\Lexer.php:295 Stack trace: #0 C:\xampp\www\wp-content\plugins\meta-box-aio\vendor\twig\twig\lib\Twig\Lexer.php(227): Twig_Lexer->lexExpression() #1 C:\xampp\www\wp-content\plugins\meta-box-aio\vendor\twig\twig\lib\Twig\Lexer.php(126): Twig_Lexer->lexVar() #2 C:\xampp\www\wp-content\plugins\meta-box-aio\vendor\twig\twig\lib\Twig\Environment.php(653): Twig_Lexer->tokenize(Object(Twig_Source)) #3 C:\xampp\www\wp-content\plugins\meta-box-aio\vendor\twig\twig\lib\Twig\Environment.php(750): Twig_Environment->tokenize(Object(Twig_Source)) #4 C:\xampp\www\wp-content\plugins\meta-box-aio\vendor\twig\twig\lib\Twig\Environment.php(447): Twig_Environment->compileSource(Object(Twig_Source)) #5 C:\xampp\www\wp-content\plugins\meta-box-aio\vendor\twig\twig\lib\Twig\Environment.php(362): Twig_Environment->loadTemplate('obra-single') #6 C:\xampp\www\wp-content\plugins\meta in C:\xampp\www\wp-content\plugins\meta-box-aio\vendor\twig\twig\lib\Twig\Lexer.php on line 295
thanks again
Hi Toni,
You need to change variables $field_id and $table_name by your value.
{{mb.rwmb_meta( 'field_id', {'storage_type': 'custom_table', 'table': 'table_name'} )}}
Hi Long, thanks for your reply,I've done that already, but then nothing is shown. maybe I am missing something?
Hi,
Please share the code that created the custom table and fields and the code in View. I will take a closer look and give a quick response.
Hi Long Thanks for your reply, I will share that, we are revisiting the whole website for more clients changes and will get to this issue later next week... will keep that as standby for now.. thanks
Hi , got it sorted with a different approach. many thanks
cheers