Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'yii'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


  1. Hi there everybody. I've only recently started experimenting with the Yii framework and must say that I'm loving it. I have however run into a slight dilemma which I just can't seem to figure out. I must admit that my javascript (jQuery) knowledge probably isn't up to scratch but I would prefer to make that part of my Yii learning experience. The problem: I want to include a search function in my header. This search function should behave exactly the same as a normal autocomplete dropdown textbox and the values of autocomplete options should be retrieved from two or more MYSQL database attributes (In this case I want to have a table for products and this one autocomplete field should enable me to search for product matches via the product_name, product_serial and product_color attributes). I have gotten a database search to work from http://www.yiiframework.com/extension/database-live-search/ . This however does a render_partial to a part of the page whereas I want possible results to be represented as a dropdown list. I would like to be able to click on one of the dropdown options and then go to this option specific page content after clicking a search button or perhaps if clicking on the specific option. To illustrate, I want to build a search box similar to that of Amazon.com (now by no means am I aiming to build such a complex underlying system, but this is just the idea of what I want to do.) http://www.amazon.com/ Now like I said I want to search through multiple attributes within my table. Ex. if I search for the string 'red', product_name, product_serial and product_color attributes will be scanned for all of the entries containing this string and if none are found the a sorry message will be displayed on the dropdown. BTW. I'm mainly using the Bootstrap extension for my UI if it might be of any additional help in building a typeahead or search form. Please if anybody can give me some assistance or point me to some sort of tutorial that will help me master this problem as it is really important to me to be able to do it exactly in the way described above! Thank you very much in advance. Kind regards, Hermann.
  2. Hi all, The more I'm dabbling with Yii, I'm disliking accessRules, it doesn't seem to work how I would like it and it is quite limiting, I don't like having to define specific usernames which can access an action. I read an article on the Yii website which I can link to if I'm allowed. Showing how you can very simply perform a check from each individual actions method (1 line of code and a new method in the base Controller class). I just wanted to get some opinions and find out how other people get around this. Thanks Simon
  3. how to include js file in controller ie. some thing like this public function actionIndex() { //load js file here $this->render('index'); } requirement is to load js file in a new page
  4. hi am trying to use Yii::app()->cache->set('2', 'name'); & access it using echo Yii::app()->cache->get('2'); but it's not printing any result, any idea why ? regards charlkes
  5. Creating a Web service with the admin panel using Yii and Backvendor Hi guys! Several days ago I've faced the quite interesting and perspective PHP-extension for the routine work automation called Backvendor. If you also have tried it please give us the feedback. For others I've made the small review and tested the extension. What is the Backvendor? As I've said above the main Backvendor objective is the maximum project automation. It helps much in the initial stages. With a few commands I've made the application architecture containing the web service and admin-panel, quickly set the CRUD for each model and made the relations between them. To my mind it looks much better and faster in comparison to the Yii standard tools. The detailed information about how it works is available on the Yii website (http://www.yiiframew...ion/backvendor/) and on the project homepage (http://mobidev.biz/backvendor.html). I identified the next main features that can be extremely useful (was taken form the official Backvendor page): - Just one console command to create basic structure of your multi application system with common core. - Backend engine that allows creating CRUD pages by setting configurations in Yii style. - Auto documentation of API version generated as a web page - API versioning. - Deployment script for moving your project to production server using Phing (http://www.phing.info/trac/) How it works There are 3 Steps I've made using the Backvendor to make the simple project. You may also review the demo which I've found at the GitHub (https://github.com/m...backvendor-demo.) Step 1. Download the extension from the site (https://github.com/m...sher/backvendor) and put it in the folder with web access (I did not change name from backvendor). After that, type in the command line: cd/path/to/webroot/backvendor php bviic.php createmultiapp - path = "/path/to/webroot/my-demo-project" In a few seconds we get the new project which is located in the my-demo-project. It already has a application structure and the base classes ready to tunning-up for the project purposes. Step 2. Before continuing we need to make the database migration (made before and provide the access in the core/config/db.php). To do that type the next commands in the console: cd/var/www/my-demo-project/applications/backend/protected php yiic migrate Step 3. Configuring the administration panel. In the new project you will need to generate a model for the required tables with Gii Tool. Its settings are placed in the file/core/config/main.php. During the model generation set the path for them «core.models» Basic settings for CRUD and models are in the file backend / protected / controllers / SiteController.php, the function reconfigureEntityParamsDictionary. In my demo-project this function looks like: self::$entityConfigDictionary = CMap::mergeArray( parent::$entityConfigDictionary, array( 'user' => array( 'modelName' => 'User', 'excludeFromGridView' => array( 'password', 'salt', ), 'excludeFromDetailView' => array( 'password', 'salt', ), 'modelAlias' => 'Blog User', 'modelAliasPlural' => 'Blog Users', 'bool' => array('admin'), 'datetime' => array('creation_date'), 'images' => array('image'), 'title' => 'username', 'link' => array( 'fb_link' => 'http://www.facebook.....php?id={value}' ), 'password' => array('password'), 'dropDown' => array( 'role' => array( 1 => 'Publisher', 2 => 'Moderator', 3 => 'Writer', ), ), 'maxUploadedImageSize' => array('width' => 200, 'height' => 200), 'selectable' => 2, 'nuke'=>true ), 'post' => array( 'modelName' => 'Post', 'notUseTitleOfRelation' => array('author'), ), 'postCategory' => array( 'modelName' => 'PostCategory', 'linksManyToManyRelation' => array('post', 'category') ), 'category' => array( 'modelName' => 'Category', 'modelAliasPlural' => 'Categories', ), )); } That's all. Each key in the array (User, Post, etc.) - is the name of the entity. The settings description you may find in - http://mobidev.biz/b...te_backend.html Configuring entities properly will help you not to create the CRUD for them manually, also you don't have to edit the model. The web service is placed in the folder apllication/webservice. It contains basic API class where you may define API methods. Links: 1) Detailed information about the project is available here (http://mobidev.biz/backvendor.html) 2) Project documentation: Full list of documents (http://mobidev.biz/backvendor_overview) Documentation for the API (http://mobidev.biz/b...ervice_api.html) Deploying code (http://mobidev.biz/b...hing_build.html) 3) What and where to download: Backvendor (https://github.com/m...sher/backvendor) Demo-version of the project (https://github.com/m...backvendor-demo)
  6. Hello, friends! Please kindly note that I'm needing to make a fancy horizontal menu that has many sublayers (not necessarily driven by a database). I'm wondering if the Book of Yii that Larry plans on issuing might give some insight on how to make these fancy menus. Also, if the menus would be created using a Javascript platform, such as Yii (I hope I'm correct here in assuming Yii is a platform for Javascript), would CSS be the backup in case the user has disabled the Javascript functionality? Lastly, would JQuery or YUI (as discussed in Larry's book on Javascript) also be able to provide this menu functionality? Thank you so very much for attending to my questions!
  7. <div id="mainmenu"> <?php $this->widget('bootstrap.widgets.TbNavbar', array( 'type'=>'null', // null or 'inverse' 'brand'=>'', 'brandUrl'=>'', 'collapse'=>true, // requires bootstrap-responsive.css 'items'=>array( array( 'class'=>'bootstrap.widgets.TbMenu', 'items'=>array( //array('label'=>'Home', 'url'=>array('/site/index')), //array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')), array('label'=>'Dropdown', 'url'=>'#', 'items'=>array( array('label'=>'Action', 'url'=>'#'), array('label'=>'Another action', 'url'=>'#'), array('label'=>'Something else here', 'url'=>'#'), '---', array('label'=>'NAV HEADER'), array('label'=>'Separated link', 'url'=>'#'), array('label'=>'One more separated link', 'url'=>'#'), )), array('label'=>'Contact', 'url'=>array('/site/contact')), ), ), ), )); ?> </div><!--main-menu--->
  8. Hi All, I am facing problem to activate an user by click on activation link that sent by email. Here is my code- UserController.php: public function actionCreate() { $model=new User; // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if(isset($_POST['User'])) { $model->attributes=$_POST['User']; $model->createtime=date('Y-m-d H:i:s'); $model->activationcode = sha1(mt_rand(10000, 99999).time().$model->email); if($model->save()) { $to = $model->email; $subject = "Welcome To My Site!" $message2 = "<html> <body>Please click this below to activate your membership<br />". Yii::app()->createAbsoluteUrl('user/check', array('activationcode' => $model->activationcode))." Thanks you </body> </html>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: My Site < admin@mysite.com>' . "\r\n"; mail($to,$subject,$message2,$headers); $this->redirect(array('view','id'=>$model->id)); } } $this->render('create', array('model'=>$model)); } public function actionCheck() { $activationcode = Yii::app()->request->getQuery('activationcode'); // collect user input data if(isset($activationcode)) { $model = User::model()->find('activationcode=:activationcode', array(':activationcode'=>$activationcode)); if($activationcode == $model->activationcode) { $model->status=1; //$model->validate(); $model->save(); Yii::app()->user->setFlash('check','Thank you for register with us'); $this->refresh(); } } // display the login form $this->render('check',array('model'=>$model)); } View file check.php: <?php if(Yii::app()->user->hasFlash('check')): ?> <div class="flash-success"> <?php echo Yii::app()->user->getFlash('check'); ?> </div> <?php endif; ?> I am not sure why activation link not working. After click on activation link then status not changed to 1 in database. Also, the page redirect to create view page. I was testing by adding 'check' in rules but then page stopped to redirect. I need quick help. With thanks, MRS
  9. I've been following this tutorial, which is great btw, and have one question. http://www.larryullman.com/2010/01/07/custom-authentication-using-the-yii-framework/ I can access the role property like this, anywhere in my application code: Yii::app()->user->role but, what I'd really like to do is use the default controller authorization in my UserController: /** * Specifies the access control rules. * This method is used by the 'accessControl' filter. * @return array access control rules */ public function accessRules() { return array( array('allow', // allow all users to perform 'index' and 'view' actions 'actions'=>array('*'), 'users'=>array('@'), // Fails 'roles'=>array(ModelConstantsRole::ADMIN), // Also Fails 'expression'=>'(isset(Yii::app()->user->role) && (Yii::app()->user->role==ModelConstantsRole::ADMIN))', ), array('deny', // deny all users 'users'=>array('*'), ), ); } It appears that the class that actually validates the rules defined in accessRules doesn't actually know anything about my role that I've assigned it. CAccessControlFilter (for those of you who don't want to search for it for 40 minutes XD). Any ideas on how I can make use of the accessRules method when I combine it with Larry's approach? Thanks!
  10. Hey Larry, i wanted to ask you, since you are a fan of Yii, could you add in a Yii framework forum into the forum maybe somewhere at the bottom so we could put our questions and stuff in there. Yii is absolutely awesome, it has helped me to understand the use of objected orientated code and also helped me almost immediately see how the MVC (Model View Controller) System works. This framework is just so great, it saves time tremedously.
×
×
  • Create New...