how is shopify rendering the pages with their own made up tags - template-engine

i know they have something like smarty but i noticed another site called storenvy.com is using the same thing that shopify is. is there an api or something that i dont know about?
they have tags like
{{ shop.url }}
how are they making this if you know of any tutorial i can get into that would be great
thanks

Shopify uses Liquid to render those tags. It's an open source Ruby library Tobi wrote a while back that makes caching really easy on Shopify’s side.

Related

How to write ruby function inside shopify liquid?

Is there a way to write a custom function in ruby and call it inside the shopify liquid theme?
I am really very new with both ruby and shopify, can anyone point me in the right direction?
The answer is no. You cannot write any Ruby scripting inside your Shopify Liquid templates. The scripting languages you can use include Javascript and Liquid.
Liquid is excellent at pulling data from Shopify that can be rendered using HTML, made to look good with CSS, and have some dynamic behaviour added with Javascript.
You can write ruby in a Shopify Shopify Plus store using the scripts app, that affects checkout (and by extension, values in the cart).
If you're using Shopify Plus then you have access to this app: Script Editor
Which will enable you to have some fun with Ruby. I haven't pushed the limits with it but we've used in projects.

RESTful API with CMS Made Simple

I have a client with a content-heavy site built in CMS Made Simple. The redesign requires a mostly AJAX interface, and I think a frontend framework like Backbone or Angular would be the way to go.
I want to avoid moving off CMS Made Simple, though (client is used to that interface, it will be annoying to migrate all the data).
I think if I could find or create a RESTful api for CMS Made Simple, I'd solve my problem. But after searching around online, I only found CGSocialApp module, which seems to provide a limited API for things like user management. I've also looked into other AJAX solutions for CMS Made Simple, and there don't seem to be good modules for it.
If there is no ready-made solution for me, how complex would building a RESTful API module be? I haven't built a RESTFUL api in a PHP framework before.
Thanks for any guidance!
So, there is no easy answer for this question, as the CMSMS doesn't have a build-in RESTful API.
I would go for one of the two solutions:
1. Output the content as hand made json.
In CMSMS, you really have a lot of control on the templates. You could change the default templates to output json content instead of HTML content. The only issue is that the CMSMS will still send an http content-type header, that you can try to ignore in the JS part.
To access the menu, just remove it from the main template and create an empty page who output the {menu}with a custom template that also build json content.
That's the quick and dirty solution, but it should be very accessible in terms of doing it.
2. Create a dedicated module.
As far as I know, there are no modules that expose the CMSMS in RESTFul format, but a module is really very easy to build. Well, you can try to build it yourself, with the help of the community. It don't really solve the current problem, but it's a hint.
I hope it shed some light on the problem.

One-page AJAX-based WordPress site. How should I do it?

I am trying to create a one-page WordPress website, something like the ones you sometimes see in ThemeForest's WP section: the whole website is a long page that has everything in one place, from about us, to portfolio, to some blog posts, to contacts.
Placing all things on one page is not difficult. But when I started thinking about how to present individual posts and pages, I realised that I probably need a general way of getting posts' data via AJAX, and create new blocks with JS. How should I go about this? I suppose this was done before, but I struggle to find something this specific on Codex or a tutorial with best practices.
Any advice or link will be greatly appreciated.
You could use a plugin such as jQuery Easytabs, download it here, that has a built-in Ajax component.
I've found that the easiest way is to just get all content to load into the divs ahead of time, vs. trying to load all pages through Ajax. However, appending something like '?ajax/ajax' to the end of your urls through the Easytabs plugin is one option that I have successfully used in the past.
If you decide to use the easytabs functionality, there is ample documentation on the page that I linked to.

Could someone explain hash tag usage for deeplinking ajax applications?

I am currently trying to full appreciate how and when to use hash tags in urls when building an ajax powered website. There seems to be a distinct lack of reading material on the web regarding this technique and as such I don't feel like I've got a good handle on it.
Could someone explain in the simplest terms how the hash tag can be used in urls to enable things like loading pages via ajax.
Thanks
You might want to take a look at Google's Making AJAX Applications Crawlable website.

Get page content with theme structure in Wordpress

I'm working on an ajax-based Wordpress site and I want to know if there is a way to get a particular page content with theme structure applied in.
One workaround is to use
wget
or
file_get_contents(page_url)
but it'd be cleaner to use Wordpress built-in functions.
Thanks.
I'd go with file_get_contents. I'm not aware of a built-in WP function to do this, but even if there was one I would expect it to be based on file_get_contents
FYI, don't use any of these methods I mentioned above because it's way too slow. I ended up utilizing the Loop and include_once(); to get the content with the theme structure.

Resources