Search code examples
phpjoomla

using jtext in php with table


i have a module in my joomla site that shows a table with some element in it, i want to localize this module for English language with joomla jtext helper; the default code is :

<table dir="rtl" id="gold-table" class="table table-hover table-responsive" style="margin-bottom: 0"><thead><tr><?php



if($title == 'true'  ){echo '<th data-field="forks_count" data-sortable="true">'. 'عنوان محصول'.'</th>' ;}

if($code == 'true')   {echo '<th>'. 'کد محصول'.'</th>'  ;}

if($cat == 'true')    {echo '<th>'. 'مجموعه محصول'.'</th>'  ;}

if($grade == 'true')    {echo '<th>'. 'گرید محصول'.'</th>'  ;}

if($unit == 'true')    {echo '<th>'. 'واحد قیمت گذاری'.'</th>'  ;}

if($packing == 'true')    {echo '<th>'. 'بسته بندی محصول'.'</th>'  ;}

if($ryal == 'true')   {echo '<th>'. 'قیمت ریالی'.'</th>'  ;}

if($dollar == 'true') {echo '<th>'. 'قیمت دلاری'.'</th>'  ;}

if($pdate == 'true')  {echo '<th>'. 'تاریخ'.'</th>'  ;} ?>

i tried to change the Persian words to jtext for using override feature to make it multilingual with the following code but i got error

   <table dir="rtl" id="gold-table" class="table table-hover table-responsive" style="margin-bottom: 0"><thead><tr><?php



if($title == 'true'  ){echo '<th data-field="forks_count" data-sortable="true">'. 'JText::_( 'COM_PROD_TITLE' );'.'</th>' ;}

if($code == 'true')   {echo '<th>'. 'JText::_( 'COM_PROD_SKU' );'.'</th>'  ;}

if($cat == 'true')    {echo '<th>'. 'JText::_( 'COM_PROD_CAT' );'.'</th>'  ;}

if($grade == 'true')    {echo '<th>'. 'JText::_( 'COM_PROD_GRADE' );'.'</th>'  ;}

if($unit == 'true')    {echo '<th>'. 'JText::_( 'COM_PROD_UNIT' );'.'</th>'  ;}

if($packing == 'true')    {echo '<th>'. 'JText::_( 'COM_PROD_PAKING' );'.'</th>'  ;}

if($ryal == 'true')   {echo '<th>'. 'JText::_( 'COM_PROD_IRR' );'.'</th>'  ;}

if($dollar == 'true') {echo '<th>'. 'JText::_( 'COM_PROD_DLR' );'.'</th>'  ;}

if($pdate == 'true')  {echo '<th>'. 'JText::_( 'COM_PROD_DATE' );'.'</th>'  ;} ?>

Thanks for your attentoin.


Solution

  • I think you dont delimit JText:

    <table dir="rtl" id="gold-table" class="table table-hover table-responsive" style="margin-bottom: 0"><thead><tr><?php
    
    if($title == 'true'  ){echo '<th data-field="forks_count" data-sortable="true">'. JText::_( 'COM_PROD_TITLE' ).'</th>' ;}
    
    if($code == 'true')   {echo '<th>'. JText::_( 'COM_PROD_SKU' ).'</th>'  ;}
    
    if($cat == 'true')    {echo '<th>'. JText::_( 'COM_PROD_CAT' ).'</th>'  ;}
    
    if($grade == 'true')    {echo '<th>'. JText::_( 'COM_PROD_GRADE' ).'</th>'  ;}
    
    if($unit == 'true')    {echo '<th>'. JText::_( 'COM_PROD_UNIT' ).'</th>'  ;}
    
    if($packing == 'true')    {echo '<th>'. JText::_( 'COM_PROD_PAKING' ).'</th>'  ;}
    
    if($ryal == 'true')   {echo '<th>'. JText::_( 'COM_PROD_IRR' ).'</th>'  ;}
    
    if($dollar == 'true') {echo '<th>'. JText::_( 'COM_PROD_DLR' ).'</th>'  ;}
    
    if($pdate == 'true')  {echo '<th>'. JText::_( 'COM_PROD_DATE' ).'</th>'  ;} ?>