What can Tabs.star in Joomla 3.1? - joomla

Parse error: syntax error, unexpected T_ECHO in
$options=array('startOffset' => 0,)
echo JHtml::_('tabs.start', '', $options);
echo JHtml::_('tabs.panel', JText::_('TABS_MATCHDETAILS'), 'panel1' );
echo $this->loadTemplate('matchdetails');
echo JHtml::_('tabs.panel', JText::_('TABS_SCOREDETAILS'), 'panel2' );
echo $this->loadTemplate('scoredetails');
echo JHtml::_('tabs.panel', JText::_('TABS_ALTDECISION'), 'panel3' );
echo $this->loadTemplate('altdecision');
echo JHtml::_('tabs.panel', JText::_('TABS_MATCHREPORT'), 'panel4' );
echo $this->loadTemplate('matchreport');
echo JHtml::_('tabs.panel', JText::_('TABS_MATCHPREVIEW'), 'panel5' );
echo $this->loadTemplate('matchpreview');
echo JHtml::_('tabs.panel', JText::_('TABS_MATCHRELATION'), 'panel6' );
echo $this->loadTemplate('matchrelation');
echo JHtml::_('tabs.panel', JText::_('TABS_EXTENDED'), 'panel7' );
echo $this->loadTemplate('matchextended');
echo JHtml::_('tabs.end');
Thanks for the answers

Firstly JPane was deprecated in Joomla 2.5 - so whilst its available to use there you should be using it. For a 2.5/3.1 component/site you should use JHtml Tabs. See the docs page here for instructions on how to use it.
In your specific case something like:
$options=array('startOffset' => 9,);
echo JHtml::_('tabs.start', '', $options);
echo JHtml::_('tabs.panel', JText::_('COM_JOOMLEAGUE_EDIT_EVENTS_EDIT_HOME_SUBST'), '');
echo $this->loadTemplate('edit_home_substitution');
echo JHtml::_('tabs.panel', JText::_('COM_JOOMLEAGUE_EDIT_EVENTS_EDIT_HOME_PLAYER'), '');
echo $this->loadTemplate('edit_home_player');
echo JHtml::_('tabs.end');
Note also that bootstrap pane's exist as of Joomla 3.0 (and will probably replace JHtml tabs in Joomla 4.0 (still a long way away) which are used in a more similar way to JPane - however these aren't particularly well documented yet - So I'd advise sticking with JHtml tabs for now

Related

How can we fetch images from database to dashboard using CodeIgniter 3

Image path is getting stored in the database and file is getting uploaded in the upload path but the image is not displaying in the tabular format.
Here is the code for the view:
<tbody>
<?php
$query = $this->db->query("SELECT * FROM banner_mgmt LIMIT 1");
// $url = base_url().
foreach ($query->result() as $row)
{
echo "<tr>";
echo "<td>$row->id</td>";
echo "<td>$row->banner_name</td>";
echo "<td>".'<img src="base_url().$row->banner_image" style="height:150px; width:150px;" alt="not found">'."</td>";
echo "<td>$row->banner_image</td>";
echo "</tr>";
}
?>
</tbody>
Assuming that base_url().$row->banner_image does actually result in a correct path/image name...
You need to check your string concatenation.
What you have... (overly complicated)
echo "<td>".'<img src="base_url().$row->banner_image" style="height:150px; width:150px;" alt="not found">'."</td>";
What you should have...
echo '<td><img src ="'.base_url().$row->banner_image.'" style="height:150px; width:150px;" alt="not found"></td>';
You need to think about how you want the string to turn out, which helps you determine when and where to use ', " and . properly.
Here I am wrapping the string using ' (single quotes), which allows me to use " (double quotes) in the HTML properties without much effort.
Read up on how to use base_url() in the Codeigniter user guide...
So you could have
echo '<td><img src ="'.base_url($row->banner_image).'" style="height:150px; width:150px;" alt="not found"></td>';
You could even use " (double quotes) which evaluate php but you will need to escape any 'internal' double quotes you want to display.
echo "<td><img src =\"base_url($row->banner_image)\" style=\"height:150px; width:150px;\" alt=\"not found\"></td>";
So, you need to read the answer at What is the difference between single-quoted and double-quoted strings in PHP?

Displaying an img from database using Codeigniter

Is there any way to display an BLOB image from database ?
I've tried this but not working:
<?print'<img src="data:image/jpeg;base64,. base64_encode($img["Imag"])"> '; ?>
echo '<img src="data:image/jpeg;base64,'.base64_encode( $img['Imag'] ).'"/>';
Try this
There is problem in your concatination also don't use print in this scenario use echo.
echo '<img src="data:image/jpeg;base64,'. $img['Imag'] .'"/>';
OR
echo '<img src='.base64_encode ($img ["Imag"].' />';

write csv file to server with codeigniter csv_from_result

Trying to save a csv file on my server with codeigniter.
my syntax is:
$this->load->dbutil();
$query = $this->db->query("SELECT id,customeraccount,band FROM Customer_Bands");
$delimiter = ',';
$newline = "<br>";
echo $this->dbutil->csv_from_result($query, $delimiter, $newline);
if ( ! write_file(base_url().'/application/authorizations/test.csv', $this->dbutil->csv_from_result($query, $delimiter, $newline)))
{
echo 'Unable to write the file';
}
else
{
echo 'File written!';
}
This is rough right now but want to get functionality working first.
Two issues.
Firstly the echo $this->dbutil->csv_from_result($query, $delimiter, $newline); outputs to my view correctly but each field is inside "", how can I remove these?
Secondly, the file is not writing to my server.
base_url() is my codeigniter root folder then inside applications I have created a folder named authorizations so base_url()/application/authorizations
This currently fails and echos 'Unable to write the file'
Thanks in advance

MediaWiki cannot get path

My MediaWiki cannot get the path of my live web server. Here is the code:
$script = $_SERVER['SCRIPT_NAME'];
$path = pathinfo( $script, PATHINFO_DIRNAME ) . '/';
$path = str_replace( '//', '/', $path );
$ext = pathinfo( $script, PATHINFO_EXTENSION );
echo "Please enter";
The localhostwebserver displays the echo as: Please enter,
but the live server displays the echo as Please enter
How is that possible? Need help!
If you need the url of the current page in php, I can recommend this script. I have used it successfully for years.

PHP 5.3.3 bug or preg_match bad validate?

<?php
$query = 'q=Riha47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a4744444444444444444444444444444444444444444444444na&start-index=60&max-results=20';
$pattern = "/^(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\];\/?:#&=+$,])*$/";
if (preg_match($pattern, $query))
echo 'true';
else
echo 'false';
The script has nothing as the output... It offers to download php file 0 bytes..
I need to fix it because it's probably still a bug in Zend_Gdata! Sorry for bad english.
EDIT:
You have a 5.3.3 version of php?
The problem disappears if you add a "U" at the end of the expression.
What the f*ck?
$query = 'q=Riha47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a47444444444444444444444444444444444444444444444444444444444444a4744444444444444444444444444444444444444444444444na&start-index=60&max-results=20';
if (preg_match('#^(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*\'()[\];/?:#&=+$,])*$#i', $query)) {
echo "TRUE"; // THIS CASE
} else {
echo "FALSE"
}

Resources