I'm working on a Laravel App and I would like to serve the content based on the user's viewport size. My app requires user login.
When the user logs in I'll also get the device view port size and store it in the session variables. So whenever a particular view is requested I can check the view port dimensions stored in the session and serve the content based on that.
My question: Is there any better way to achieve what I want?
Edit
I know responsive design. The trouble I'm facing with the CSS media queries is the tables. I've hard time making the tables responsive and present them meaningfully. And I've several pages with table data in my app. So I thought I can use the above approach.
I can even optimize the mobile pages to load the fewer resources. I don't want all the features available on desktop to be in mobile. This means that right now my webpage has hidden content, unused plugins and resources on the mobile devices.
So instead of loading the content and 'hiding' it, why not just load the minimum data(and resources, plugins) required for the mobile devices?
Edit 2
After further research I found answers to my questions. I found that there is whole new concept of dynamic serving, which is adopted by most of the large sites. Often it is difficult to achieve everything with CSS media queries. And the css code can get cluttered.
Also the frameworks like Laravel makes it easy to manage the different views. So in such cases dynamic serving can be helpful.
Related
I'm looking for a solution that allows multiple websites to share the same table/database for just the gallery page.
The scenario is that one website will host all the images uploaded while the other website will pull images from that site and filter them to only have the ones relevant to itself. I only want to share the table/database for just the gallery images and not other posts.
Does anyone know if there is a solution that already exists for this kind of problem?
Shared databases (it's called a remote database when accessing one not on your domain/server) are possible, but they tend to get pretty hairy very quickly.
You'd be better suited to use the WP REST API to query posts (if it's a custom post type (also note if it is a custom post type, you may need to register the endpoint on the API: Read more here)) or if it's media library files, you can query media directly using http://v2.wp-api.org/reference/media/
This exact scenario is almost exactly what the v2 API was designed to deal with, and it will save you an enormous amount of stress instead of relying on two installations working on the same database.
Alternatively, you could host the images on a CDN and make queries to the CDN based on that particular site's needs.
I'm working on a website I eventually plan on purchasing a domain for and having, hopefully, many users. Of course, a lot of people plan on that and it never comes true! Regardless, I'm progressing forward with the intent of having a good looking interface that's efficient in it's data usage.
One thing I would very much like to do is to have my banner / header and side-bars persist when they navigate to separate pages inside my site. My header contains the site-wide context menu as well as login and profile information, and the side-bars are currently undecided, but potentially just static images.
I don't know exactly how I would do it well. I could just use my PHP session object, but I'd like to be as efficient as possible.
I'm using a traditional LAMP stack, HTML, JS and CSS (using the Bootstrap library) on Ubuntu on an Amazon's EC2 service.
You could create a file with header and sidebar and then use this php code:
include("nameofthefile.php");
on every file of your site
I am currently trying to figure out a way to create templates for a number of pages that look exactly the same. The only thing that is different is the content part.
I have worked with PHP and include() to separate several parts of my pages, but still need something that allows me to set a default layout and styling of an entire page since I will be creating thousands of pages that are identical.
Please help me with some tips! Highly appreciated.
thousands of pages that are identical.
As stated in the comments, you should definitely go with a CMS (Content Management System)
Main features of a CMS:
Allow for a large number of people to share and contribute to stored data
Control access to data based on user role (i.e., define information users or user groups can view, edit, publish, etc.);
Facilitates storage and retrieval of data;
Control data validity and compliance;
Reduces duplicate inputs;
Simplify report writing;
Improve communication among users.
Define data as almost anything: documents, movies, texts, pictures, phone numbers, articles etc.
Content Management of Pages
Reference: http://en.wikipedia.org/wiki/Content_management_system
With that said, unless you want to spend countless hours studying and learning (which is not a bad thing) but it seems that you simply want to get this sophisticated website working, then a CMS is what you really need.
Take a look at what i believe are the top CMS's out there:
Joomla
Wordpress
Dupral
In a nutshell, you just need to get your Host, http://www.godaddy.com/ (not my personal favorite) but for simplicity; godaddy will install the CMS for you with a click of a button, it will setup everything and get you up and running! After that is complete, you can login via the administrator panel and play around with the settings to see how things work.
I would start with WordPress, heres a nice site to get you going once you have everything setup (assuming you go for Wordpress CMS)
http://www.siteground.com/tutorials/wordpress/wordpress_start.htm
http://codex.wordpress.org/Site_Design_and_Layout
Have fun! Hope this helps.
I have a web site which is developed using Zend framework. Now the requirement came for a mobile site for same system. So I have two solutions in my mind. I would like to know what is the best solution I should select.
Develop separate views and layout for the site keeping Controllers of existing site. By detecting the device serve relevant view.
Duplicating the existing system create new Zend module and modify everything to support mobile browsers.
Appreciate all your suggestions.
You could either pick up the incoming request and check if it's a mobile device, as zysoft says, or you could look at going down the route of rewriting your existing views so they're "responsive". That is, the layout adapts to the size of the screen of the device being used to view your site.
The benefits of a responsive design is that you're not relying on a list of device names or whatever to match and serve a mobile-specific page (as it goes on the screen size, not the device's identity). The downside is, it's a bit more work than making some 'light' views.
You've also got to consider that devices no longer sit in between "desktop" and "mobile" groups—there's a plethora of devices in between such as tables, netbooks and TVs that makes responsive web design more and more desirable.
As I understand the issue is only with heavy design and some elements that mobile doesn't support. You can solve it by creating separate views folder and set it as primary in application initialization where you detect mobile. It gives you a way to save all hard work on controllers, keep the code unified and provide people with a kind of "mobile theme" for the site.
I've been trawling SO for a couple of hours tonight looking for some answers, but I've not found anything that really answers what I'm after. My apologies if it has, in fact, been answered already.
I'm designing a new website and I'm trying to decide on the architecture to use to serve the content. In the past, my websites have used PHP feeding data into Smarty templates.
However, recently at my work, I've been working on a Java web application where jQuery was used to retrieve the data from a RESTful API (which returned JSON), where HTML template pages were used as the base and javascript was used (utilising jQuery) to fill in the content.
My question:
The website I'm designing will be in PHP, but would it be better to construct (or use an existing) RESTful API or to continue on as I've done before feeding the data into Smarty templates?
Are there real benefits to one or the other, or does it just come down to developer preference/experience?
If it helps, the website will be for a church, where the content types will be CMS-like; news/announcements, wiki-like pages, and a limited type of social networking (for the minister to communicate with parishioners).
Short answer: It sounds like filling the content with JavaScript would not be useful in your case. Loading the data with JavaScript is adding a layer of complexity with minimal or no benefit (in your case). Take a look at CMSs and websites that have similar functionality to what you're doing. WordPress, Drupal, etc.
For an example of when it might be useful to load data with JavaScript, check out the tags section on this site. When you search for a tag it queries the server without reloading the page. However, the initial tag list is loaded during the initial page load without any JS.
Here are some cases where you might benefit from loading information with JS:
There is some data that will take longer to load. For example, you're getting data from a web service. Using the traditional method, you would need all the data you need for the page to be available before it can be displayed. If you loaded that data with JavaScript, the page could load and the slow data would appear when it returns. Realistically, you would probably just cache the data but this is just an example.
You will be getting more data as the user stays on the page. You might want to update the page without refreshing.
You want the user to be able to query more data without refreshing the page.
Your users have limited bandwidth (mobile).
This site has more guidelines: http://www.oracle.com/technetwork/articles/javase/index-137171.html