I have two sites, on two different platforms. One is on Wordpress, it lives at blog.example.com. The other is on Shopify, it lives at shop.example.com.
They both have the same header.
What is the best way to have the header code live in one place and have the header included on both sites? The only way I can think of off the top of my head is an iframe, which doesn't seem like the right idea.
Anyone have a way to do this?
The best approach will be to manage the header from one platform Shopify or Wordpress and get it from the other via AJAX ( if you allow CORS on the WordPress side) or using a crawler.
Since WordPress is more robust when it comes with custom back-end logic I recommend managing the Header from Shopify and crawling it from WordPress in order to use it. (have in mind that the links must be absolute, not relative)
If you plan to manage it from WordPress and if the CORS is not enabled, you will need to create custom App that will have to craw the WordPress site and get the header. From there depends how you like to store the header:
create a snippet via the Assets API and update it manually with a sync button or cron job
create a proxy app page that you will request and will return the header markup
TLDR; the easiest solution will be to make an AJAX request from the Shopify site to the Wordpress site and get the HTML, if you enable CORS on your wordpress hosting.
Related
Me and a couple of other people have put together an e-commerce site (I will not tell you the url because I am not here to promote it). The web site is a wordpress website(yes, the plugins have gotten that advanced now). The distributor, the people who actually make and send out the products, have made is such that I can communicate with them via RESTFUL API calls. I have looked at some of the wordpress plug-ins for this and it seems that they will allow me only to do command-line web server calls to my website from outside.
How can I code my website to make the calls to the REST API of another website? I do not know where the best place is to go to start researching this? Maybe I need to hard code the PHP of my website somewhere?
I am just look for a starting point and advice at this point.
I'm trying to set up a Wordpress Multisite network on Google App Engine. I have the install up and running, and am mapping custom domains for each site with the help of this plugin. I'm using Wordpress 4.0.
The domain mapping works, in that when I navigate to the custom domain it pulls up the corresponding site, but when I try to access any admin pages from the custom domain, I get an SSL error. I gather that this is due to Google's not allowing custom domains to access GAE apps via SSL, and so I've been trying to fix this by redirecting all requests of the form mycustomdomain.com/wp-admin/(.+) to myapp.appspot.com/wp-admin/\1.
My rationale for trying this is that myapp.appspot.com/subsite/wp-admin/ works just fine, but mycustomdomain/wp-admin does not, despite the two pointing to the same location.
Unfortunately, I haven't been able to figure out how to do this redirection properly. I've tried adding redirect rules to the .htaccess file with no success. I've also tried messing with app.yaml handlers, but this, too, yielded no results.
Also worth noting is that I attempted to force all requests to go through http (as a hackish, temporary workaround) via this plugin to no avail.
I'm new to working with servers, and any help would be much appreciated. I'm not even sure that redirection is the right solution, so I welcome any other suggestions. I can supply pertinent code if needed. Thanks.
EDIT: I could go through Google's custom domain registration process via Google Apps and get an SSL certificate that way, but my app will eventually be used by a large number of independent sites that I don't control, so that solution won't work.
I have been trying to achieve something similar on a regular server and not on GAE, so I'm not sure this will apply to you...
Isn't the 4th option of the Domain Mapping what you're looking for? In the WP network administration, go to Settings > Domain Mapping, then you can tick/untick the 4th option :
4. Redirect administration pages to site's original domain (remote login disabled if this redirect is disabled)
This will allow you to use a custom domain to access a site and its wp-admin interface, allowing SSL certificates to validate since the domain stays the same.
I am new in PhoneGap,
I have a Joomla Site, I want to create a PhoneGap App using that Joomla site. so is this possible ? if yes than how can i implement it ?.
You can use. But you have to create web services for request and responses. Because Phonegap will not run PHP script. So you can create webservices to access Joomla functionality via JSON responses from your joomla. You can get the JSON data via jQuery in your phonegap app.
and someone said PGBuild will convert webpage into phonegap app. You can try it also.
I have succeeded creating an application as follows:
Design your Joomla page so it's responsive and renders correctly on your mobile;
Download the whole thing with wget
Edit all urls and make them point to the right (local-remote) locations.
I saved all css, images, js locally so the page would load even offline; then changed all the links so they point to the remote host;
All forms should point to the remote host;
Most modules and components were changed so after the initial display (local) they will load the updated info in the frame.
Popups won't be available, so you'll need heavy workarounds for facebook integration etc.
Also, if you plan to use any phonegap features, they will only be available if you load the library inside your downloaded page; this will force you to change all calls to ajax (no document.location.href calls are possible since you'll lose the phonegap javascript).
The first time you load the page from the server it will take forever to load. Ensure you have proper caching set up otherwise you'll just lose your customers.
My advice is to start with an ajax project at the very beginning, it will save you lots of headaches.
Keep in mind, if you plan to use iframes, forget it. They work lousily on iphones, and debugging is nearly impossible. Simply take your time to plan a real phone app in javascript & using Ajax for the calls.
You don't need any webservices in Joomla for loading content, simply use:
&tmpl=component
when you need the content of a module.
Additionally, for blogs and lists, Joomla makes RSS feeds available so you shouldn't need too much coding to achieve this.
I have limited myself to ajaxifying the modules, which makes caching more efficient on the server and the interfaces appear more dynamic.
Good day!
I have a PHP based web application, that I am looking to add a Wordpress to.
The main application is in the root folder, and wordpress is installed in /wp
In order to get WP content into my application, I am using a JSON API (http://wordpress.org/plugins/json-api/)
Then, from the application, I am calling the API with CURL.
Is this a good way to go about calling the API? CURL seems to be very slow, and I think it has something to do with sessions, and the fact that it is requesting a url on the same domain.
Or perhaps someone could offer a suggestion on a better way to go about getting wordpress content into a non-wordpress based application.
Thanks for the help!
I am developing a SaaS based application in PHP , in which my clients (web site owners ) can create and customize some contact forms. Then I would like to publish that page to my client web site with out showing the url ( I mean it needs to seem like the page from my clients domain ). We can see the same situations in surey monkey and other online chat applications . Please help me to solve this .
Thanks in advance,
Sunil
4 Solutions:
iframe - Downside is, many people don't like them. Some people have security issues with it. Other than that, they are just fine.
External Javascript file - Include it in your header, have it populate the page with specific content. Works like a charm and you can even use remote files: <script src="http://external.com/form.php" type="text/javascript"></script>. Downside, possible conflicts in the page if user wants to include own content on the page. Personally I prefer this method and use it in syncing a website menu across multiple servers (some apache, some tomcat).
JSONP - Much like the external Javascript file, load up the external page via a JSONP request. Downside, a lot of configuration, more than just including the one line above.
curl - Great tool, no way for anyone to realize the content is from another side. Requires backend configuration and more than just plain HTML. More coding. More professional.