Jump to content

qtguru

Members
  • Posts

    357
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by qtguru

  1. Give Onsen.io a spin, it's way better, I use it for a financial institution for the company i work for, however it's in Angular assuming that's a bottleneck
  2. I don't really develop Android Apps per se, I only Integrate some libraries with it, so am mostly doing non -UI related, your question is wrong, because as of now, Android Studio is the Defacto way to go about Android Development, Eclipse is not gonna get any future support from Google and Android Studio is way better, especially with Gradle as a way to run deployment codes and tests.
  3. I can write a book on why i don't use Wordpress i wrote a long rant on it in a forum before, I am thinking of writing an article, however i do have some fears, so many Wordpress Ninjas and goons around me.
  4. At this day and time, i don't expect anyone to turn off JavaScript, and if they do it's obvious they are not interested in browsing alot of sites esp Angular and SPAs
  5. not enough to help you out, more code or explain better
  6. http://okeowoaderemi.com (My personal site) http://sarahsnest.com HUGE NOTE: I am not a designer, so most of my works have been on the Development aspect.
  7. Best Part is that I have a Data used in Wordpress to get subscribers so without breaking changes , I could easily forgo the Page Object Mantra and also pull directly from the database private function getFollowers($member_id){ $database=wire('database'); $statement=$database->prepare("SELECT COUNT( * ) FROM `member_subscribers` WHERE member_id = :member_id"); $statement->bindParam(":member_id",$member_id,PDO::PARAM_INT); $statement->execute(); $result=$statement->fetch(PDO::FETCH_NUM); return $result[0]; } Luckily this is PDO and it's totally awesome, My Client is really happy with the outcome of the Project because she loves the backend of Processwire and also that Google analytics someone created, and really i was skeptical of PW at first (because if something is too good to be true, then something must be wrong secretly) but now i feel more comfortable with it more than ever, I could go the PW "Everything is a Page Model" or go Rogue and cook up some things, but I love the everything is a page in some scenarios, e.g getting Parent of pages and finding Children , in some ways it feels like JCR in Java but not that advanced though. However i still have much questions ? 1. Having Multiple Albums per User 2. Social Authentication Seriously guys give Dropzone.js a spin for frontend uploading, it's dead easy, good bye
  8. Uploading code in the BackendController public function upload(){ header("Content-type:application/json"); if($this->appContext->premium == 1){ if(count($this->appContext->images) >= self::PREMIUM_MEMBER_IMAGES){ return json_encode(array( 'status'=>'error', 'data'=> sprintf("Your Premium account has exceeded the maximum amount [%d]",self::PREMIUM_MEMBER_IMAGES) )); } } else if(count($this->appContext->images) >= self::REGULAR_MEMBER_IMAGES){ return json_encode(array( 'status'=>'error', 'data'=> sprintf("Your Premium account has exceeded the maximum amount [%d]",self::REGULAR_MEMBER_IMAGES) )); } $config=wire('config'); $file=$_FILES['file']; $wireuploader=new WireUpload('file'); $wireuploader->setDestinationPath($this->appContext->images->path); $wireuploader->setMaxFiles(1); $wireuploader->setOverwrite(true); $wireuploader->setValidExtensions(array('jpg', 'jpeg', 'gif', 'png')); $wireuploader->setTargetFilename($file['name']); $wireuploader->setAllowAjax(true); $resultSet=$wireuploader->execute(); if(!$wireuploader->getErrors()){ //Let's save the article to the page $this->appContext->of(false); $this->appContext->images->add($this->appContext->images->path.$resultSet[0]); $this->appContext->save(); return json_encode(array( 'status'=>'success', 'data'=> sprintf("The %s has been saved to your profile successfully",$file['name']), "count"=>count($this->appContext->premium) )); } else{ return json_encode(array( 'status'=>'error', 'data'=>$wireuploader->getErrors() )); } } } At first i was skeptical about it adding to the pages, because i felt it's too good to be true so checking the Real backend and viola this is the images added to it via the frontend
  9. As seen in this code here: <?php class BackendController{ const REGULAR_MEMBER_IMAGES=20; const PREMIUM_MEMBER_IMAGES=40; public function gallery(){ $view=new TemplateFile(dirname(dirname(__FILE__))."/admin_templates/gallery.php"); $view->set('images',$this->appContext->images); return $view->render(); } public function index(){ return $this->profile(); } public function profile(){ $view=new TemplateFile(dirname(dirname(__FILE__))."/admin_templates/default.php"); $view->set('member_name',$this->appContext->fullname); $view->set('twitter',$this->appContext->twitter); $view->set('member_workinfo',$this->appContext->works); $view->set('country',$this->appContext->country); $view->set('member_age',$this->appContext->age); $view->set('member_brand',$this->appContext->brand); $view->set('member_phone',$this->appContext->phone); $view->set('member_address',$this->appContext->address); $view->set('member_information',$this->appContext->information); $view->set('followers',$this->getFollowers($this->appContext->post_id)); return $view->render(); } The index calls the profile function, now the appContext is the Page Object which was inserted into the property of the class by SegmentUrlController, its kinda hackish but hey it works for me, I could have used wire('pages') but i need the Member details which was saved into the session after a user logs in, but i felt this was easier, this feels like my typical MVC Convention, however I noticed i hadn't test with calling Ajax which was why i added the code $config->ajax to simply exit as not to render a page. The gallery /member-dashboard/gallery works well I use DropZone a good JS library for uploading and also WireUpload and it worked smoothly no issues at all
  10. URLSegments are awesome so i wanted to build a backend for the users , after cracking my head and losing confidence in my skills, I think at some point I was crying, till it hit me , wait a minute FrontDispatchers in Zend Framework take the route or the url and dispatches the Action to be called right, so I created a Module that alters my template when on a page called member-login and session is set, then it takes the user to the member-dashboard page, now on that page URL Segment has been enabled. Here is the source code that takes the url and handles the action: <?php $session=wire('session'); if($session->get('currentUserLogged') !== true){ $session->redirect($config->urls->root."/member-login"); } require (dirname(__FILE__)."/admin_url_segments/SegmentUrlRenderer.php"); //let's get the current page from the session $StyljunkiPageMember=$pages->get($session->get('SessionMember')); $segment=new SegmenturlRenderer($input,$StyljunkiPageMember); //If it is an Ajax Call return the call and nothing else if($config->ajax){ echo $segment->dispatch(); exit(); }else{ $content=$segment->dispatch(); } Here is the source code of the SegmentController: <?php /** * This class handles the Url Segment and selects a view to be rendered * */ class SegmentUrlRenderer { private $urlsegment; private $context; public function __construct($UrlSegment,Page $Context) { $this->urlsegment = $UrlSegment; $this->context = $Context; } public function dispatch() { //first get the controller folder return $this->processURL($this->urlsegment); } private function processURL($input) { //typical rules //URL 1: Controller Class //URL 2: Controller Class Method $controller_class = $this->urlsegment->urlSegment(1); $controller_action = $this->urlsegment->urlSegment(2); if ($controller_class === '') { $controller_class="Backend"; } if ($controller_action === '') { $controller_action = "index"; } //Get the matching controller $matching_controller = ucfirst($controller_class). "Controller.php"; $matching_controller_prefixless=ucfirst($controller_class)."Controller"; $controller_folders = dirname(dirname(__FILE__)) . "/controllers/"; if(!file_exists($controller_folders.$matching_controller)){ throw new WireException(sprintf('The Specified Controller File [%s] doesn\'t exist',($controller_folders.$matching_controller))); } require_once ($controller_folders . $matching_controller); //We need to introspect let's see that the method exists $controller = new $matching_controller_prefixless(); $controller->appContext=$this->context; //Add the prehook if (method_exists($controller, "prehook")) { return $controller->prehook(); } //does the method exist in the class if (method_exists($controller, $controller_action)) { return $controller->$controller_action(); } } } So i have a folder called "controllers" which has one controller class called backend so it the user types http://localhost/StyljunkiPW/member-dashboard/backend It resolves to the default controller which is index as seen in the code here if ($controller_class === '') { $controller_class="Backend"; } if ($controller_action === '') { $controller_action = "index"; } So it works and renders the dashboard this is the profile page which pulls information from the Page Object
  11. My Preferred method of Developing Processwire Templates If you look at the normal tutorials pitched at developing Processwire website, it's really not flexible, how so you generate alot of content and perform concantenations alot here's an example of my previous styling following the PW standard <?phpob_start(); //Get the Slides $ImageArray=$page->get('images'); $CountImages=count($ImageArray);?> <?php if($CountImages): ?> <div id="carousel-example-generic" class="carousel slide " data-ride="carousel"> <ol class="carousel-indicators"> <?php for($i=0; $i < $CountImages; $i++): if($i==0): ?> <li data-target="#carousel-example-generic" data-slide-to="<?php echo $i ?>" class="active"></li> <?php else: ?> <li data-target="#carousel-example-generic" data-slide-to="<?php echo $i ?>"></li> <?php endif; endfor; ?> </ol> <div class="carousel-inner"> <?php $count=0; foreach($ImageArray as $images): $thumb=$images->size(600,450); ?> <div class="item <?php echo ($count === 0) ? "active":"" ?>"> <img class="" src="<?php echo $thumb->url ?>" style="height: 450px;width: 600px;" alt="" /> <div class="carousel-caption"> <p> <div> <?php echo $images->description ?> </div> </p> </div> </div> <?php $count++; endforeach; ?> </div> <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> </a> <a class="right carousel-control" href="#carousel-example-generic" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> </a> </div> <?php endif; ?> <br/> <div class="col-md-12 pull-right"> <a class="pull-right" href="#"><img src="<?php echo $config->urls->templates?>/img/facebook_sarahs_nest.png" alt=""></a> <a class="pull-right" href="#"><img src="<?php echo $config->urls->templates?>/img/twitter_sarahs_nest.png" alt=""></a> <a class="pull-right" href="#"><img src="<?php echo $config->urls->templates?>/img/youtube_sarahs_nest.png" alt=""></a> </div><?php $homeContent=ob_get_clean(); $content= $homeContent. $content; ?> <h4>Sarah's Nest in Pictures</h4> <div class="col-xs-6 col-md-4"> <a href="#" class="thumbnail"> <img src="<?php echo $config->urls->templates?>/img/Official-Opening16.jpg" alt="..."> </a> </div> <div class="col-xs-6 col-md-4"> <a href="#" class="thumbnail"> <img class="img-responsive" src="<?php echo $config->urls->templates?>/img/Rabbit.jpg" alt="..."> </a> </div> <div class="clearfix"></div> <br> <div class="col-md-8"> <img src="<?php echo $config->urls->templates?>/img/sarahs-nest-object-bg.jpg" alt=""> </div> <?php $content.=ob_get_clean(); ?> Now how this works is that we put a content in this page and the _init.php holds global variables to be used e.g $title,$content while this is good it's become difficult to achieve flexibility and really I don't enjoy concatenations that much as I have to ensure it doesn't have any implication on performance. The dilemma with this, is that you will no doubt have to put alot of logic in the templates which later become ugly, an example of such was when i need a front-page admin it felt hackish to have a logic in the same template to load a seperate css if login and if not. luckily PW is not opinionated that much, meaning you are free to do what you want. This is my preffered style. <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title><?php echo $title; ?></title> <meta charset="utf-8"> <link href="<?php echo $config->urls->templates ?>css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="<?php echo $config->urls->templates ?>css/helper.css" rel="stylesheet" type="text/css" /> <link href="<?php echo $config->urls->templates ?>css/font-awesome.min.css" rel="stylesheet" type="text/css" /> <link href="<?php echo $config->urls->templates ?>css/jquery.fancybox.css" rel="stylesheet" type="text/css" /> <link href="<?php echo $config->urls->templates ?>css/animate.css" rel="stylesheet" type="text/css" /> <link href="<?php echo $config->urls->templates ?>css/style.css" rel="stylesheet" type="text/css" /> <link rel="shortcut icon" href="favicon.ico"/> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> <meta name="format-detection" content="telephone=no" /> <title>Symphony</title> </head> <body> <!--Header goes here--> <?php echo wireRenderFile("ui/header.php"); ?> <?php echo $content ?> <?php echo wireRenderFile("ui/footer.php"); ?> In this the main loads several fragments of the pages into the layout so you might be curious how does the template look like , well it looks like this home.php <?php $content=wireRenderFile("ui/fullscreen-slider.php",array( "title"=>$title, "body"=>$page->body, "slideshows"=>$page->sliderImages, "middleImage"=>$page->middleImage )) ?> This way it's more cleaner and easier to read and you can perform alot of logic easily such as swapping templates based on seperate scenarios, I know this doesn't explain much I will post a tutorial soon enough, as this has increased my speed in PW Development.
  12. http://radiotunes.com/newage seriously you would thank me later it's awesome am an Enya fan and also Lorenna Mcklennit but it seems many more awesome music.
  13. So today found a new strategy for building processwire website and it's more awesome than all the strategy in place, because it allows you to easy modify codes without bothering about appending to content or pre-pending to content, will write a tutorial about this. ever since i discovered wireRenderFile(), it made things easier for me. Will drop a tutorial soon, please keep this post in mind.
  14. lol the video cracked me up, I love companies like this, used to work in one in mauritius during break time, we'd be gaming PS3 and stuff. but my current job in Nigeria is so formal that i can't even take off my tie.
  15. I actually thought it was Dojotoolkit you were referring to
  16. First of all Jordanlev thanks for the input, I do understand what you mean, its until i came to the point where i felt It was more easier to build my own dashboard into Processwire than go with the Everything is a page "Mantra" and kongondo has a very valid point, there are situations where everything doesn't have to be a page. Though I think because most of the forum focuses on using pages for nearly everything. I do disagree that Processwire has nothing to offer, because it still gives the ability to easily wire modules and follow your own style. I would say we are both building the same type of applications where viewing the information in Pages would be a bit weird for clients. @Jordanlev I would be eager to get some of your experiences and practices as it seems we are both dealing with the same type of application. which is why i feel processwire 3.0 should be discussed on a round table so we can delibrate on how to enhance Processwire much more better. @kongondo thanks lot because of you and Adrian moving from Wordpress to Processwire with all my articles was seamless and quick.
  17. Hi just came across another bus stop. I am trying to implement a system, when users can create images and put them in a collection. e.g Gallery Album A->has 5 images while Gallery Album B -> 2 images however in Processwire if you add a field to a template it adds to all pages making it hard for Members(Pages) to have individual Galleries or not. Thanks all won't mind pointers from experienced minds.
  18. I don't think so, its better to have multiple options yeah there's an existing Validator Module however they will always have different design paradigm I for once don't like GUMP, I like this API it's cleaner also it reminds me of Yii, imagine a platform where we only have one option. @justb3a I actually love this Validator, will probarbly fork this and see ways to add custom validation and also a way to inject this in InputForm process input. Good work bro or sis
  19. is there any way to add custom validation like Valitron
  20. It's why i asked what caching solution was implemented even a good system can be bottle-necked by bad code. Am really liking Concrete 5 its a proper MVC system which is something i'd like. Also as much as i love Processwire I don't think I would ever use it as a replacement for eCommerce but for anything else Hell yeah there's systems like Prestashop. Thanks Jordan
  21. 500 means its a server problem and Server Configuration nothing you can do except just relax.
  22. am not a C5 user but it depends where the sites slow due to heavy resources e.g images,css,assets or slow as a result of bottleneck from C5, I intend to pitch CS to my company to manage the website for the organization because the Frontend Editing is a good option for us, and also PW for our documentation page, we don't want to be called to manage contents its very depressing and boring for us. Did you explore any Caching Solution for C5 ?
  23. Just use RequireJS and in each page just load the scripts you need KISS because that method above doesn't handle dependency of libraries unlike RequireJS
  24. you mean something like passing a variable to a template the way Views are rendered in MVC frameworks try the TemplateFile Class <?php // this is your template file, or a controller if you will: $view = new TemplateFile(); $view->some_param = "PW"; $view->filename = $config->paths->templates."views/{$page->template}.php"; echo $view->render();
  25. @Jordan am surprised how i never came across Concrete5 it has something I have been looking for the concept of MVC and frontend editing. I would probably look more into this and try it out for a Project. This really appeals to Developer namescapes,Form Object and all. Am gonna give it a spin we are evaluating something in our office, all our developers love using MVC-ish (anything related to MVC) to code. Thanks also
×
×
  • Create New...