Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
i'm working on a big project. i'm using codeigniter, but i'm facing a hard question, where should i using codeigniter caching. should i use it inside models? or in the controller? also as my project is big, i'm facing a hard time trying to guess what caches should i delete as the codeigniter caching is depending on the controller name, so when i update a table i have to check all controllers that are using that table and delete their cache. that kills me.
what is the best practice for this?
Thanks
CodeIgniter have a good cache for small projects, but when you need to exclude things, it gets kind of messy. It's not decentralized.
A good solution for query cache is http://code.google.com/p/improved-query-caching/ and as Wesley told you, http://philsturgeon.co.uk/code/codeigniter-cache.
I also don't recommend using the query cache for ALL your queries, but instead using the ones that really needs it. It depends a LOT in the project and its size.
Remember that cache use only view. For example if you want to change language on the site it doesnt work because codeigniter will load old wiev with old language. And then you must wait untill new cache will be created and loaded with language which is currently set.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
Is reactjs (or nextjs) suitable for classic website? I will develop website for kindergarten. Is it good or bad idea to go with react? Of course as multiple page app... Or will be better idea to use PHP (with laravel)? I don't know PHP much (And laravel). On the other side I know reactjs+nextjs+expressjs and I want to improve in it, so i think it could be good idea to use this project for learning and training...
What do you think? Should I use rather reactjs+nextjs+expressjs or PHP+Laravel?
Thanks for every opinion! :)
PS: In my country is VPS very cheap, so it is not problem to use expressjs (nodejs) for kindergarten website...
You could also go with next export, and serve the website via cdn for example.
Read more at https://nextjs.org/docs/advanced-features/static-html-export
I would go with nextjs anyways, it’s opinionaited anyways whichever someone recommends, and you want to code in that and learn that, so why not.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I found a similar questions, but it's not exactly what I am looking for.
I write web site using php. For dynamic content I use jQuery Ajax.
I have 20-50 functions and I want to use Ajax to call these functions and take JSON.
Idea is to pass parametres via ajax POST. Pages works with database and job is done.
The question - how better organize it?
Should I create 50 separate pages like:
mysite.com/ajax/delete_project.php
mysite.com/ajax/delete_user.php
mysite.com/ajax/show_user_info.php
mysite.com/ajax/show_my_messages.php
mysite.com/ajax/show_my_tasks.php
mysite.com/ajax/send_message.php
.......
or create one page? or maybe i am completely wrong with all of that
Ideally you should be using a framework, such as Symfony. Otherwise, I usually keep all the functions for each content type in a single file. So you might have:
mysite.com/api/blog_posts.php which would implement GET, POST, PUT, DEL, etc... for all the blog posts. Meanwhile, mysite.com/api/messages.php would handle that for all messages.
You must start using an MVC framework if not using already. I would say Laravel should be a good choice, it's easy to learn, feature-rich and fun to work with. Start looking into Laravel Routes.
Moving to MVC is the best way to start getting into shape in your case.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Hello all and thanks for taking the time to view this.
I want to make a PHP application and I am about to start, but I want the front/backend to have as little page loads as possible, but I just don't know what to learn per se. I am torn as to whether I should learn Ajax, AngularJS, EmberJS, NodeJS, BackboneJS, etc?
I really want to know if AJAX is the same as the others I listed or not. I just want to use PHP as the engine to fetch data from an SQL DB and make the application's front/backend seamlessly.
I would like to be pointed in the "right" direction as to which technology to take.
you can use angularJS for faster loading of pages, learning path is first you have knowledge of ajax, then you can learn AngularJs.
here is a reason why you can use angularJs
http://code.tutsplus.com/tutorials/3-reasons-to-choose-angularjs-for-your-next-project--net-28457
and you are going to use PHP as Backend so it eliminate node.js from this list, AngularJs is best as you have describe your requirement, if you know bit of javascript learning cure for angularJs is easy.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm in the process of learning ASP.NET and I'm having a few difficulties with certain things. The main difficulty I have right now is accessing data from a database. Usually in PHP in the model I'd just write an SQL query for a specific model function and then that'd query the DB and return the results I want to the calling controller. Is doing this fine in ASP MVC? And if so how do you do it? The tutorial I was following started using scaffolding and I want to avoid that as I want to fully understand how it all fits together.
I myself started in PHP and gradually moved to .NET. The way I manage my database is via Entity Framework. I know it may sound like you've got to learn yet another useless thing, but it is actually very simple. If you just want to learn the concept: use code first approach.
This is how it works: you create a bunch of models (that you will need anyway its called Model-View-Controller for a reason) that are nothing but objects. Those models are used to build your database. So you no longer need to set up the database manually (e.g. phpMyAdmin). It sounds quite amazing but that's how it works and then you use LINQ (or LINQ-to-SQL) to get queries.
This an example of a LINQ-to-SQL query:
var query = from u in dbContext.User where u.UserID == 1 select u;
This will come useful later on as well when you want to validate information etc. Here is a great starting tutorial (just watch the first 4 of those videos):
https://www.youtube.com/watch?v=Z7713GBhi4k&list=PL6n9fhu94yhUPBSX-E2aJCnCR3-_6zBZx
Moving from PHP to .NET is a big move, but it is really worth it.
Good Luck!
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm currently working on a project that uses MySQL for configuration, but now I'm starting to think it could slow down page loads.
So my question is, would it be better to store configuration options (that are read almost every page load) inside an XML/JSON file, or a MySQL database?
Thanks.
One thing to conside is how much config data there is, and perhaps how often it is likely to change. If the amount of data is small, then saving this in a database (if your not already using a db for anything else), would be overkill, equally maintaining a db for something that gets changed once every 6 months would probably be a waste of resources.
I think this depends on your projects. If you want someone else to configure the application through the UI you can put the configurations into the database.
If its just you and some developers, and changes are not made frequently, put them in a file.