zf2 do not recognize the CSS library? - css

Why my zf2 do not recognize the css library?
The Firefox console shows me this:
GET http://localhost/pandramon/public/css/css/animate.css [HTTP/1.1 404 Not Found 229ms]
GET http://localhost/pandramon/public/css/css/font-awesome.min.css
My code:
<!-- Le styles -->
<?php echo $this->headLink(array('rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/favicon.ico'))
->prependStylesheet($this->basePath('css/animate.css'))
->prependStylesheet($this->basePath('css/font-awesome.min.css'))
->prependStylesheet($this->basePath('css/style.css'))
->prependStylesheet($this->basePath('css/bootstrap-theme.min.css'))
->prependStylesheet($this->basePath('css/bootstrap.min.css'))
?>

<?php
echo $this->headLink(
array(
'rel' => 'shortcut icon',
'type' => 'image/vnd.microsoft.icon',
'href' => $this->basePath() . '/img/favicon.ico')
)
->prependStylesheet($this->basePath() . '/css/bootstrap-responsive.min.css');
?>

Related

How to properly save a WordPress option containing HTML code?

Here's a screenshot of what the problem looks like:
And the HTML of that part of the WordPress options page looks like this:
So, in the WordPress admin area, I entered a piece of HTML code (to have a clickable link as the output on the frontend).
This was the code I had entered into that text input field on the backend:
<a title="Website Design London" href="../../website-design/">Website Design</a>
And while on the frontend that link is displaying OK, I'm seeing this mess (see screenshot) on the backend.
As far as I can tell the relevant PHP code is this:
$this->text(
'workdone',
esc_html__( 'Work done', 'mytheme' )
);
So, what is the proper way to save an option that contains HTML code?
And how can I fix the mess shown on the screenshot?
I had the same issue, and this code is working for me:
// render service label
public function render_service_label() {
$value = get_option( 'wbk_service_label', '' );
$value = htmlspecialchars( $value );
$html = '<input type="text" id="wbk_service_label" name="wbk_service_label" value="'.$value.'" >';
$html .= '<p class="description">' . __( 'Service label', 'wbk' ) . '</p>';
echo $html;
}
// validate service label
public function validate_service_label( $input ) {
$allowed_tags = array(
//formatting
'strong' => array(),
'em' => array(),
'b' => array(),
'i' => array(),
'br' => array(),
//links
'a' => array(
'href' => array(),
'class' => array()
),
//links
'p' => array(
'class' => array()
)
);
$input = wp_kses( $input, $allowed_tags );
return $input;
}
So, in the dashboard options page I use htmlspecialchars function
In frontend page I use like this:
$label = get_option( 'wbk_service_label', __( 'Select service', 'wbk' ) );

How to use $link for watchdog messages in drupal?

I tried using l()
watchdog('my_module', 'My message for /admin/reports/dblog', WATCHDOG_NOTICE,
$link = l(t('A hyperlink'),
'/node/386/group?realname=&uid=&state=All&order=created&sort=desc',
array('attributes'=>array('target'=>'blank'))) );
but the hyperlink is encoded "node/386/group%3Frealname%3D%26uid%3D%26state%3DAll%26order%3Dcreated%26sort%3Ddesc" which I understand is because l() is supposed to generate urls from drupal paths.
Can I decode it before it's rendered or what's the proper way of inserting that hyperlink?
You should use query key for generating the path as shown below
<?php
global $base_url;
print l(
'',
$base_url . $node_url,
array(
'attributes' => array(
'id' => 'my-id',
'class' => 'my-class'
),
'query' => array(
'foo' => 'bar'
),
'fragment' => 'refresh',
'html' => TRUE
)
);
?>
This will generate a link like
<img src="http://www.example.com/files/image.jpg"/>
Source: https://api.drupal.org/api/drupal/includes%21common.inc/function/l/7.x
Just use this:
$link = l(t('A hyperlink'), '/node/386/group', array('attributes'=>array('target'=>'blank'))));
watchdog('my_module', 'Link !field_link.', array('!field_link' => $link));

Growl Widget Kartik with AdminLTE template

How i can intregate Growl Widget Kartik Yii2 with AdminLTE Template. When i used the widget not show the animation and position defined from Controller.
CompraController.php
... if ($flag) {
$transaction->commit();
Yii::$app->getSession()->setFlash('success', [
'type' => 'success',
'duration' => 5000,
'icon' => 'glyphicon glyphicon-ok',
'message' => ' Compra Registrada ;)',
'title' => 'Registro Compra',
'positonY' => 'top',
'positonX' => 'right'
]);
return $this->redirect(['index']);
}
main.php
... <?php foreach (Yii::$app->session->getAllFlashes() as $message):; ?>
<?php
echo Growl::widget([
'type' => (!empty($message['type'])) ? $message['type'] : 'danger',
'title' => (!empty($message['title'])) ? Html::encode($message['title']) : 'Title Not Set!',
'icon' => (!empty($message['icon'])) ? $message['icon'] : 'fa fa-info',
'body' => (!empty($message['message'])) ? Html::encode($message['message']) : 'Message Not Set!',
'showSeparator' => true,
'delay' => 1, //This delay is how long before the message shows
'pluginOptions' => [
'delay' => (!empty($message['duration'])) ? $message['duration'] : 3000, //This delay is how long the message shows for
'placement' => [
'from' => (!empty($message['positonY'])) ? $message['positonY'] : 'top',
'align' => (!empty($message['positonX'])) ? $message['positonX'] : 'right',
]
],
'useAnimation'=>true
]);
?>
<?php endforeach; ?>
When i use the normal template of Yii2 works fine:
But when i use the AdminLTE template, every option is trated like a different notification:
Apparently the AdminLTE Template it has its own notification methods that prevent the execution of Growl Widget. I remove the line:
<?= Alert::widget() ?> in:
<section class="content">
<?= Alert::widget() ?>
<?= $content ?>
</section>
from the file views/layout/content.php and works fine.

Yii button with property submit - is not working

Yesterday it was working. After many changes (but not with it template) - it's not.
Yii generates button as usually, but now by clicking it does nothing.
<?= CHtml::button('Sell', array(
'submit' => CController::createUrl('product/selll', array('productID' => $data->id)),
'style' => 'width:80px',
)); ?>
Maybe i have found the problem - it is because jquery.yiiactiveform.js is not loading automaticly. Why it's not loading any more?
I have found solution. The problem is Yii form above, i've comment input text field, than no one Yii::button is working at all.
This is a code of form above:
<?php
$form = $this->beginWidget('CActiveForm', array(
'id' => 'searform',
'enableClientValidation' => true,
'enableAjaxValidation' => true,
'clientOptions' => array(
'validateOnSubmit' => true,
),
'action' => array("user/searchForm"),
));?>
!!!!If i comment this textField - no one CHtml::button dont work.!!!!!
<?php echo $form->textField($search,
'product',array('width'=>'179px','height'=>'17px','value'=>$value,'save'=>$value)); ?>
<? /*
<div id="srcBtnWrap">
<?= CHtml::submitButton('',array('id'=>'srcBtn')); ?>
</div> */ ?>
<? //= CHtml::submitButton('go'); ?>
<?
$this->endWidget();
?>
Is it Yii bug, or i do something wrong?
jquery.yii.js should be loaded. If it is loaded - check JS console for errors.
Check if your action does not use die() or exit()
You have enabled client validation. Please, check errors and give us model fields (rules)
'enableClientValidation' => true,
'enableAjaxValidation' => true,
'clientOptions' => array(
'validateOnSubmit' => true,
),

Adding a second Wordpress widget

I'm having difficulty with setting up a second sidebar for my Wordpress theme.
Here's the code for function.php:
<?php
if(function_exists('register_sidebar')){
register_sidebar(array(
'before_widget'=>'<li>',
'after_widget'=>'</li>',
'before_title'=>'<h2>',
'after_title'=>'</h2>',
))
;
}
?>
<?php
if(function_exists('register_sidebar')){
register_sidebar('home'array(
'before_widget'=>'<li>',
'after_widget'=>'</li>',
'before_title'=>'<h2>',
'after_title'=>'</h2>',
))
;
}
?>
This is the error I'm receiving when I try to access the widget options page in admin:
Parse error: syntax error, unexpected
T_ARRAY in
C:\xampp\htdocs\tlc\wp-content\themes\tlc\functions.php
on line 14
to give it a name you use this syntax
register_sidebar(array(
'name' => 'RightSideBar',
'description' => 'Widgets in this area will be shown on the right-hand side.',
'before_title' => '<h1>',
'after_title' => '</h1>'
));
not what you wrote
see this for more info
http://codex.wordpress.org/Function_Reference/register_sidebar

Resources