How to add two calendars in a page - Joomla - joomla3.0

I am new to joomla, want to implement two calendars in a page ...
From :
<?php
echo JHTML::calendar('sch_from', 'sch_from', '%Y-%m-%d');
?>
To :
<?php
echo JHTML::calendar('sch_to', 'sch_to', '%Y-%m-%d');
?>
But first calendar only working... is there any issue in code?

syntax is:
JHtml::calendar($value,'nameOfField','idOfField', '%Y-%m-%d');
located at libraries/cms/html/html.php
try
From :
<?php
echo JHTML::calendar('','sch_from', 'sch_from', '%Y-%m-%d');
?>
To :
<?php
echo JHTML::calendar('','sch_to', 'sch_to', '%Y-%m-%d');
?>

Related

Cakephp echo username into page title

I am currently learning Cakephp and have made a profile page of which displays the username on it. You can only access this page when logged in so when you are on this page, I wish to display the username of the user in the HTML page title. This is also because your profile page is visible to other users.
At the moment to get the page headers I have used.
<title><?php echo $this->fetch('title'); ?> | Site Name</title>
<? $this->assign('title', 'Profile')?>
And to display the username on the page currently I have:
<?php echo $user['User']['user_name']; ?>
I have attempted to combine these two into something like shown below but clearly that's not working. Any ideas?
<? $this->assign('title', '<?php echo $user['User']['user_name']; ?>')?>
Thanks!
Mistake in the concatenation, change this in your .ctp
<? $this->assign('title', '<?php echo $user['User']['user_name']; ?>')?>
to this
<? $this->assign('title', $user['User']['user_name'])?>
Later on add this in your layout
<title><?php echo $this->fetch('title'); ?> | Site Name</title>
This will work :)

cakePHP 3.3 internationalization

How can I set multiple language in case text is in array?
I know that if I use this
<?= __('username')?>
and in directory /src/Locale/de_DE/default.po
I have written following
msgid "username"
msgstr "benutzer"
It's gonna change username to benutzer if I set language to de_DE (german)
But what to do if I have this
<?= $this->Form->input('password',['label' =>'Password']); ?>
and I would like to change label Password
Simple:
$this->Form->input('password', ['label' => __('Password')]);
The __() function simply returns the translated string (more info). In your example you used
<?= ... ?>
which is equivalent to
<?php echo ... ?>

Meta noindex in post and page untranslated (unavailable) with Yoast

Is possible enter in the of posts and pages untranslated a meta robots noindex?
Of course, versions already translated, must instead stay indexable ...
I have Yoast SEO plugin compatible but I can not change meta robots per single language.
Just put this in the header of your theme. Language plugin that I use is qtranslate:
<!--Begin add noindex and nofolllow when not translated post in current lang-->
<?php if ( have_posts() && is_single() ) : while ( have_posts() ) : the_post();
$lang_current =qtranxf_getLanguage();
$id = get_the_id();
$exist_translate = qtranxf_isAvailableIn($id, $lang_current);
if (! ($exist_translate) ) : ?>
<meta name=“robots” content=“noindex,nofollow”>
<?php endif;?>
<?php endwhile;?>
<?php endif; ?>
<!--End add noindex and nofolllow when not translate post in current language-->

My view in cakephp give error "Call to a member function create() on a non-object ",why?

View contain following code:-
<?php
echo $form->create('Post',array('action'=>'add'));
echo $form->input('title');
echo $form->input('body');
echo $form->end("Create a post");
?>
As mentioned in the official documentation it is not
$form
but
$this->Form
And that since CakePHP1.3

cakephp + cache + formhelper inside <cake:nocache></cake:nocache> = error

in all my views i have a login/register (cake)form.
my question:
can i use the file cache engine with <cake:nocache>form</ cake:nocache>
1.) open url "www.domain.com/home"
2.) cachefile generated
3.) look perfect
4.) refresh (f5)
5.) error (when debug=1):
Parse error: parse error in C:\xampp\htdocs\cake_1.2.3.8166\app\tmp\cache\view \cake_1_2_3_8166_home.php on line 752
cachefile -> line 752 -> </html>
cakephp: 1.2.3.8166
example:
<cake:nocache>
<?
$user = $session->read("user");
if(!$user){ //$user true or false
echo "login:";
echo $form->create('AdminUser', array('action' =>'login_load'));
echo $form->input('email',array('label'=>false));
echo $form->input('password',array('label'=>false));
echo $form->submit('Login', array('id'=>'login'));
echo $form->end();
}else{
echo "hello user!";
}?>
</cake:nocache>
it's a cakephp bug. cake google groups
The dev state at https://trac.cakephp.org/ticket/6034 CakePHP does not support using the form helper from within tags at this time.

Resources