Quantcast
Channel: Yii Framework Forum
Viewing all 18717 articles
Browse latest View live

When Image upload Text no file Selected click to open file manager?

$
0
0
Hi,

Am using Yii Version 1.1.8,

I need to show file Manager only click browse button.My Issue Once click text no file selected also open File Manager.

Is it possible to open file Manager once clicked Browse Button only Don't need to open File Manager When click text No file

Selected Or Image name.

Please Tell me Solution for my issue,Is it possible in Yii Or not?

Am just write my code,

<?php echo $form->fileField($model, 'floor_plan',array('style' => 'border :none !important')); ?>

It's Showing Browse Button & also No file Selected text.But only file Manager open When click browse button not no file Selected text.

Yii2 app with CraftCMS (built on YII1.1)

$
0
0
Hey guys/gals,

I'm beginning the process of breaking our PHP app that is built inside CraftCMS out into a Yii2 app. Before I get into my question(s) here are some background details:

Tech stack:
CraftCMS 2.6.2993 (uses Yii 1.1.19)
AngularJS (1.6)
PHP 7.0.x
Ubuntu 16.04 (Apache 2.4.18)

How it works:
1.) User visits a URL and Craft determines that's a URL we have defined (non 404).
2.) CraftCMS serves up the HTML via a template which we plug our angular app/partials into.
3.) User interacts with something on the screen (ie: submit button) that requires us to go get data from an external source (another REST api).
4.) JS function called which runs an $http.post() to the backend (same server so just posting to index.php).
5.) CraftCMS controller receives request and processes then returns JSON back to the AngularJS app.

What I need to do:
Run Yii along side CraftCMS on the same server and have them differentiate which one should be receiving given request.
Move template loading into YII (that's phase 2).

The end goal is to have CraftCMS run as "headless/content as a service" where it's essentially just a content management API to request content from and serve up on the page. Yii will then be handling all of the template loading and PHP business logic instead of having them as CraftCMS plugins.

Technical details:

Currently the way we call CraftCMS to get session data/etc is to do an $http.post() to /index.php and the postbody contains an "action" key that specifies which counter should receive this request.

Unfortunately I'm having trouble calling a Yii controller using the same logic. We have a "validate" plugin that contains a controller "Validate_AddressController.php" with a function "actionValidateAddress()". This action receives a JSON body with the address and it then calls out to an external vendor to actually validate the address.

However, when I try to post to this controller action I'm unable to hit it. It appears that CraftCMS is receiving the request first and then returning a 404 immediately and/or YII is never receiving the request.

Folder Structure:
<project folder>
    <craft>
    <backend>
        <yii files>
            <controllers>
                 - AddressController.php (the file I want to call).
    <src>
        <js files>



How can I set this up to differentiate which requests should go to CraftCMS and which ones should go to Yii2? Am I attempting to post incorrectly to Yii? I've tried to do $http.post('/address/validateAddress', {body}) but this doesn't seem to work.


TL;DR -- I want to treat Yii2 almost like a restful API but it needs to exist on the same server as another YII app.

Unexpected Session Switching happening randomly in Yii 2.0

$
0
0
Dear Sir / Madam

We have a peculiar situation happening over a period of few weeks, wherein, Session of any logged in user, is being automatically changed to another user, due to which, all business activity in the application, are happening with the other user, for the subject (whose session is changed / automatically hijacked).

Note: The Session is being "Changed To", Session of Users who had enabled Permanent Cookie using "Remember Me" checkbox, as per our initial observations. Most of the time, this random session override is happening automatically to a single user account, for all users (whose session is being overridden)

We are using Yii 2.0 for all our applications and this problem is imminent and the root cause is still not established, for sure.

We do really appreciate, inputs in this regard

thank you
Saran

download file

$
0
0
Mohon bantuan,, bagaimana cara untuk download file dari server...
saya coba error terus,, file yang sudah terdownload tidak bisa dibuka, corrupt file...

'file jpeg'

Zależności standardowo dołączonych bibliotek JS

$
0
0
Witam.

W pliku: yii/framework/web/js/packages.php są zadeklarowane zależności bibliotek JS ale deklaracje te u mnie nie są respektowane przez Yii. Dlaczego?

Rbac para yii2 basic.

$
0
0
Hola, hasta el mes pasado estuve usando yii versión 1, donde los controles de acceso y que puede o no hacer , los hacia con la magnifica extensión CRUGE. Ahora migre a yii2, la version basic, mi pregunta es que extension tipo cruge puedo utilizar para yii2 basic, vi por ahi q esta la ext yii2-admin pero solo dice q es para avanzada, q me recomiendan para la version basic?

Kondisional Button di CGridView

$
0
0
Agan2 minta tolong bantu dong kalau saya mau membuat 2 button untuk merubah status User Aktif atau Nonaktif.
- Jadi jika statusnya Nonaktif bisa langsung diubah hanya dengan mengklik tombol "Aktifkan" seperti digambar ini,
- tapi kalau statusnya Aktif tombol yang mucul jadi "Nonaktifkan" begitu. Jadi update statusnya lewat button, tidak perlu membuka semua field lewat edit form.

apa saja ya yg harus sya tambah di MVC nya....
Mohon dibantu pencerahannya. Trims banyak

  • : Screenshot_3.png

Csqldataprovider Diferent Connection....

$
0
0
Hi all...

i have cdbconnection to connect sphinx server like this :

$dsn = 'mysql:dbname=catalog;host=127.0.0.1;port=9306;';
$port='9306';
$connection=new CDbConnection($dsn);
$connection->active=true;



i wanna use CSqlDataProvider to show data from sphinx to datagrid.
$sqlStatement="select * from catalog where match('@value oracle')";
$dataProvidersphinx = new CSqlDataProvider($sqlStatement, array(
                    'keyField' => $key,
                    //'totalItemCount' => $count,
                    'sort' => array(
                        'attributes' => array(
                            'entry', 'value',
                        ),
                    ),
                    'pagination' => array(
                        'pageSize' => 10,
                    ),
                ));

but i get error cause connection still use mysql not sphinx
Syntax error or access violation

my question : how to use my cdbconnection to execute CSqlDataProvider,... ??

Thanks.

TbExtendedGridView - row colors

$
0
0
I am very new to yii, have been going thru tutorials, and looking at forum posts. I see several forum posts on this topic, but all my attempts so far have failed.

I am attempting to modify an existing application for support tickets. We have a process where a support rep must assign the ticket to a support group level, then the ticket must be acknowledged by the support group the ticket was assigned to. We get emails after 15 minutes warning that the ticket hasn't been acknowledged. Until we receive the email, we don't necessarily know which tickets have and have not been acknowledged. I want to set the background color in the TbExtendedGridView listing of the tickets based on whether the ticket has been acknowledged.

I've looked at this posting http://www.yiiframework.com/forum/index.php/topic/7646-cgridview-how-to-color-rows-depending-on-data-values/page__p__38802__hl__cgridview+color+#entry38802 which details how to set the color attributes using rowCssClassExpression.

So far every time I attempt to use this setting it completely disables my gridview.

I have attempted to add a function to the tickets.php file, which is my class definitions for the tickets class.

/*public function getColor($colorstr as string) {
// $colorstr in value passed from calling function
// if empty, no value set - return 'green'
// if not empty, ie.. value is set - return 'white'
$colorstr = 'white'; // defaults to value being set

if strlen(trim($colorstr)) == 0) { $colorstr = 'green';} // value not set

return $colorstr;

}
*/

any time I uncomment this function I get an error, even though there is nothing calling this function.

I'm attempting to determine which css file is used for the TbExtendedGridView, I don't see any statement in the class file which specifies the default css file for this. I've looked at the main.css and override.css files, so far unable to affect the grid row background color when I make changes. I've modified the odd and even color settings, in the override.css file, but it has no affect.

Searching in the documentation didn't help with this at all, there was no mention of color parameters for the row in the CGridView portion of the document. There was nothing about TbExtendedGridView at all.

I would appreciate any assistance, pointers etc..

Thanks,
Randy

Important note about Bower and the asset plugin

$
0
0
Bower has changed their registry URL some time ago and has now announced to deprecate the old URL. Old registry will be disabled next Wednesday. In order for your work not to be affected make sure to update your composer asset plugin to the latest version:

composer global require "fxp/composer-asset-plugin:^1.4.2"


Versions prior to 1.4.2 use the https://bower.herokuapp.com/packages URL for fetching bower packages, which currently redirects to https://registry.bower.io/packages. This URL will be disabled on Wednesday, October 26, 2017 according to the Bower announcement so asset plugin versions prior to 1.4.2 will not be able to fetch any packages.

There is also a news announcement about this.

Yii2 micro API

$
0
0
HI!


see my repo , example basic use yii2 micro restful api with module ( see module - diary, maybe have more ... )
i use this skeleton for build application SPA - Single page application , currently testing EmberJS ( in 5hour learn youtube i make SPA , nice )

https://github.com/havennow/micro-yii2

How SiteController Loading

$
0
0
"Where initial controller is set as Site Controller in Yii" to understand the architecture
when I search for this I got lot solution how to set using

return array(
'defaultController' => 'home '
);

Can anyone give me an idea where exactly site controller is assigned.

How to remove Yii and ReInstall?

$
0
0
Hi all
I'm new to Yii
did few instalations
but it seems that something is wrong and I want to clean it all and reInstall.

how do I do that?



thanks in advance...

Looking for an interesting Yii project

$
0
0
Hi, everyone!

Right now I've succesfully finished several huge Yii projects (as a senior dev and team-lead as well). And looking

for new exciting opportunitites (since the usual support on previous projects takes less time, than I've ecpected,

since we've done everything correctly from the 1st time).

Shortly about technology and area of expertise

- Experience in development of LAMP(PHP/Yii 1/2/Zend 1 and 2/Laravel/Symfony 2)- based complex business applications

for 7 years
- Experience in automated QA of complex web-based software for 4 years
- Experience in load/stress testing and fine-tuning complex PHP-based software for large traffic.
- Javascript (jQuery, angularJS, Ajax)
- mySQL, postgresSQL, noSQL
- Experience with backend and API for mobile applications
- responsive html coding and front-end works are also not a problem :-)
- Real-estate, medical, insurance and transport industries

Ready for long-terms and exciting projects. Can work in a team (create my own or in yours). PM me or simple send an

email to v.webdeveloper@yahoo.com. Also skype is stanislav_grigoriev

Thanks for your attention :-)

Russian yii2 developer

$
0
0
A plenty of experience with yii2.

My skils and portfolio: internetsite.com.ua/en
My video blog about yii video (sorry, in Russian): youtube.com/channel/UC3jTSXXgSvQI2WJ5fX6oIwA
My toster (Russian analogue of stackoverflow) profile: toster.ru/user/webinar

Consider remote work, relocation and other options

35YO, citizen of Ukraine, but live in Russia

Theoretically, I will be cheaper than local experts. Apologize to them, but it is a fact.

My skype: inet_shop1
My name: Max
My fb: facebook.com/profile.php?id=100010558870786

Yii/Yii2 developer

$
0
0
Hello Everyone,

I have 8+ years of experience in Web Designing and Development. having sound knowledge and expertise in Yii/Yii. Currently, I'm looking for a new project. If anyone has a requirement, Please let me know. 100% quality work and timely delivery GUARANTEE.

Skype: Webchirag92@gmail.com

Thanks.

Add third party class / Adwords

$
0
0
Hi everybody,

I would like to use a third party class in projet in yii 1.1.19. (Cf url to download the library / api adwords)

URL of the library : http://www.1check.com/googleads-php-lib.zip


for example, In my controller, i have to use a function (cf call below). This function is in googleads-php-lib\vendor\google\auth\src

$oauth2 = new OAuth2([
'authorizationUri' => Yii::app()->params->Adwords_authorizationUri,
'tokenCredentialUri' => Yii::app()->params->Adwords_tokenCredentialUri,
'redirectUri' => Yii::app()->params->Adwords_redirectURI,
'clientId' => Yii::app()->params->Adwords_client_id,
'clientSecret' => Yii::app()->params->Adwords_client_secret_key,
'scope' => Yii::app()->params->Adwords_scope,
]);

i tried to use alias but always i have many errors like that : Fatal error: Interface 'Google\Auth\FetchAuthTokenInterface' not found in etc...

I tried to include vendors like that : require_once googleads-php-lib/vendor/autoload.php

but nothing...

I don't know how to use this library with yii 1

anyone can help me ?

many thanks

Ludo

Yii2 Install Tip

$
0
0
Hey,

Just a bit of a random thought, should the tip to install a dev version of Yii2 on this page not be in green? I always go to copy it without realising its for a dev version.

Maybe there is a better color. Any how I realise its like not important at all.

Yii2 php sessions question

$
0
0
'm attempting to run a Craft app alongside a Yii2 application currently. I've got the correct app bootstrapping at the correct time but am running into a session writing issue.

I'm writing the sessions into a local file (default apache2 file).

For some reason when I attempt to add a variable to the session using $_SESSION['something'] = 'test'; in my Yii2 app it becomes unavailable the minute the app shuts down.

I'm adding this 'something' key to the session in Yii2 and attempt to access the session variable in my Craft app about 3 seconds later.

Any ideas why this session variable is getting lost? If I print out the $_SESSION before I return from my Yii2 app it's there but then it gets lost from the session after my action finishes executing?

The way my controller finishes executing is this:

//Setup for the return of JSON.
        \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
        header('Content-type: application/json');

        $returnData = self::filterOutSensitiveResponseInfo($returnData);

        //Get timeouts for the front-end.
        $returnData = [
            "responseData" => $returnData
        ];

        //Handle logging of the return from controller.
        if(self::includeCurrentActionInLogs()){
            self::logActionTiming();        
            self::logActionResponse($returnData);
        }

        //output JSON to the front-end.
        echo json_encode($returnData, JSON_PRETTY_PRINT);

        //Handle successful shutdown of the application.
        \Yii::$app->end();
        return;

Once this code is done executing I'm immediately calling another controller action and looking at $_SESSION but that variable I stored previously is no longer there?

Exception 'yii\db\Exception' with message 'SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)'

$
0
0
What steps will reproduce the problem?

following tutorial code(dot)tutsplus(dot)com /tutorials/building-your-startup-with-php-feature-requirements-and-database-design--cms-22618

install yii, make a database, user, put the credentials in \environments\dev\common\main-local.php

<?php
return [
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=your-db',
'username' => 'your-username',
'password' => 'your-pwd',
'charset' => 'utf8',
],
then run ./yii migrate/up 1

What is the expected result?

Creating migration history table "migration"...done.
Total 1 out of 15 new migrations to be applied:

What do you get instead?

Error: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
on clearlinux web server

-or-

Exception 'yii\db\Exception' with message 'SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)'
on Ubuntu localhost

Additional info

Q A
Yii version 2.0.?
PHP version 5.6.31 and/or 7.1.8
Operating system Ubuntu 17.10 and/or CloudLinux
Viewing all 18717 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>