Posts Tagged with a

Displaying 1-10 of 241 results.
Resolved: Yii2 ActiveForm password autocomplete off chrome not working
posted by admin on June 9, 2017
I have ActiveForm in Yii2 and password section and username filled automatically and autocomplete="off" not working on Chrome

<?php $form = ActiveForm::begin([
'options' => [
//'autocomplete' => 'off'
],
]); ?>
. . .
<div class="row">
<div class="col-md-12">
<?= $form->field($model, 'password_change')->passwordInput(['maxlength' => true, 'autocomplete' => 'off'])->label('password') ?>
</div>
</div>
. . .
<?php ActiveForm::end(); ?>
Read more
Resolved: Yii2 showScriptName remove index.php Not Found apache
posted by admin on June 2, 2017
I tried to remove index.php from url by many ways, but without results.
My OS is Ubuntu Linux.
Server Apache.
In web.php in config directory

<?php
$config = [
'components' => [
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'/' => 'site/index',
'login' => 'site/login',
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
],
],
]
]

Still not working
I try to created .htaccess in web direcory

RewriteEngine on
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . index.php

Still without result
In result
404 Not Found

Not Found

The requested URL /login was not found on this server.

Apache/2.4.18 (Ubuntu) Server at tracker.dev Port 80

Please help me to resolve problemRead more
Resolved: Yii2 load controller with default language
posted by admin on June 2, 2017
I have project and I want to load website with default language and sourceLanguage or etc., but I cant change language in controller and in view.

\Yii::$app->language = function_any_logic_for_website();
//not working for controller and view, and not set language

How to resolve problem?Read more
Resolved: WordPress How to remove cells(columns) from admin posts and pages table
posted by admin on April 21, 2017
altIn my wordpress website I have a few plugins, for example Yuzo Views, All in One Seo, etc, and they insert their columns to wordpress posts and pages editing tables, and I cant see general information in admin, like title, categories, tags etc. All fields very narrow, and I can't read information normally.Read more
Resolved: PHP fopen fwrite tab tabulation
posted by admin on April 18, 2017
I have code, where I create file and write string in that file
PHP:

$string = "Some text \t any text";
$handle = fopen($filename, 'w');
fwrite($handle, $string);
fclose($handle);

Output as same as I try to create

Some text \t any text
Read more
Resolved: Odnoklassniki OK api apiok users.getInfo all fields without errors
posted by admin on April 17, 2017
I try to get all allowed fields from user by id, and got some error

{
error_code:100
error_msg:PARAM : Invalid parameter fields value : [accessible,age,allows_anonym_access,allows_messaging_only_for_friends,birthday,blocked,blocks,can_vcall,can_vmail,capabilities,common_friends_count,current_location,current_status,current_status_date,current_status_date_ms,current_status_id,current_status_track_id,email,feed_subscription,first_name,friend,friend_invitation,gender,has_email,has_service_invisible,invited_by_friend,is_activated,last_name,last_online,last_online_ms,location,login,modified_ms,name,notifications_subscription,online,photo_id,pic1024x768,pic128max,pic128x128,pic180min,pic190x190,pic224x224,pic240min,pic288x288,pic320min,pic50x50,pic600x600,pic640x480,pic_1,pic_2,pic_3,pic_4,pic_5,pic_base,pic_full,pic_max,premium,presents,private,ref,registered_date,registered_date_ms,relationship,show_lock,uid,url_chat,url_chat_mobile,url_profile,url_profile_mobile,vip]
error_data:null
}

All fields I got from apiok official page

[{
accessible:Boolean
age:Integer
allows_anonym_access:Boolean
allows_messaging_only_for_friends:Boolean
birthday:String
blocked:Boolean
blocks:Boolean
can_vcall:Boolean
can_vmail:Boolean
capabilities:String
common_friends_count:Integer
current_location:{
altitude:Float
cellId:Integer
city:String
country:String
ipAddress:String
latitude:Float
longitude:Float
}
current_status:String
current_status_date:Date
current_status_date_ms:Long
current_status_id:String
current_status_track_id:String
email:String
feed_subscription:Boolean
first_name:String
friend:Boolean
friend_invitation:Boolean
gender:String
has_email:Boolean
has_service_invisible:Boolean
invited_by_friend:Boolean
is_activated:Boolean
last_name:String
last_online:String
last_online_ms:Long
locale:String
location:{
city:String
country:String
countryCode:String
countryName:String
}
login:String
modified_ms:Long
name:String
notifications_subscription:Boolean
online:String
photo_id:String
pic1024x768:String
pic128max:String
pic128x128:String
pic180min:String
pic190x190:String
pic224x224:String
pic240min:String
pic288x288:String
pic320min:String
pic50x50:String
pic600x600:String
pic640x480:String
pic_1:String
pic_2:String
pic_3:String
pic_4:String
pic_5:String
pic_base:String
pic_full:String
pic_max:String
premium:Boolean
presents:[{}]
private:Boolean
ref:String
registered_date:Date
registered_date_ms:Long
relations:[{}]
relationship:{}
show_lock:Boolean
uid:String
url_chat:String
url_chat_mobile:String
url_profile:String
url_profile_mobile:String
vip:Boolean
}]
Read more
Wiki: Loads a JavaScript file asynchronously with a callback, like jQuery's $.getScript() except without jQuerywiki
posted by admin on April 13, 2017

function j(u, c) {
var h = document.getElementsByTagName('head')[0], s = document.createElement('script');
s.async = true; s.src = u;
s.onload = s.onreadystatechange = function () {
if (!s.readyState || /loaded|complete/.test(s.readyState)) {
s.onload = s.onreadystatechange = null; if (h && s.parentNode) { h.removeChild(s) } s = undefined;
if (c) { c() }
}
};
h.insertBefore(s, h.firstChild);
}
Read more
Wiki: How to make an AJAX call without jQuery with GET and POST?wiki
posted by admin on March 27, 2017
Using the following snippet you can do similar things pretty easily, like this:

ajax.get('/test.php', {foo: 'bar'}, function() {});

Here is the snippet:

var ajax = {};
ajax.x = function () {
if (typeof XMLHttpRequest !== 'undefined') {
return new XMLHttpRequest();
}
var versions = [
"MSXML2.XmlHttp.6.0",
"MSXML2.XmlHttp.5.0",
"MSXML2.XmlHttp.4.0",
"MSXML2.XmlHttp.3.0",
"MSXML2.XmlHttp.2.0",
"Microsoft.XmlHttp"
];

var xhr;
for (var i = 0; i < versions.length; i++) {
try {
xhr = new ActiveXObject(versions[i]);
break;
} catch (e) {
}
}
return xhr;
};

ajax.send = function (url, callback, method, data, async) {
if (async === undefined) {
async = true;
}
var x = ajax.x();
x.open(method, url, async);
x.onreadystatechange = function () {
if (x.readyState == 4) {
callback(x.responseText)
}
};
if (method == 'POST') {
x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
}
x.send(data)
};

ajax.get = function (url, data, callback, async) {
var query = [];
for (var key in data) {
query.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key]));
}
ajax.send(url + (query.length ? '?' + query.join('&') : ''), callback, 'GET', null, async)
};

ajax.post = function (url, data, callback, async) {
var query = [];
for (var key in data) {
query.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key]));
}
ajax.send(url, callback, 'POST', query.join('&'), async)
};
Read more
Wiki: Yii2 basic include css js files to module views layout main from module assetswiki
posted by admin on March 1, 2017
Module Information
Module Admin

app/modules/admin/Module.php
app/modules/admin/views/default/index.php

Create Module ASSETS in Web folder with content

app/modules/admin/web/assets/css/style.css
app/modules/admin/web/assets/js/main.js

Create Module views layouts

app/modules/admin/views/layouts/main.php

Change your Module and change layouts way in your config web.php

<?php
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['gii'],
'modules' => [
'gii' => [
'class' => 'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'] // adjust this to your needs
],
'admin' => [
'class' => 'app\modules\admin\Module',
// the layout that should be applied for views within this module
'layout' => 'main',
],
],
...........

Create Module new assets settings class
In modules/admin directory create file AdminAsset.php with content

<?php
namespace app\modules\admin;
use yii\web\AssetBundle;

class AdminAsset extends AssetBundle
{
public $sourcePath = '@app/modules/admin/web/assets';
public $css = [
'css/style.css',
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
];
}

Go to your Admin Module layouts/main.php and replace your assets registration and namespace with

use app\modules\admin\AdminAsset;

AdminAsset::register($this);
Read more
Resolved: Yii2 basic render path problem in modules
posted by admin on March 1, 2017
In my layouts I have code with render

. . .
<div class="wrap">
<?= $this->render('/partials/menu'); ?>
</div>
. . .

And when I run my Module I have got error

The view file does not exist: The view file does not exist: /var/www/html/vktracker2/modules/admin/views/partials/menu.php

I tried to fix by

<?= $this->render(dirname(_FILE__) . '/partials/menu'); ?>

But it didn't helpRead more