Can I use/adapt the Kohana userguide module to create help pages for my application? - module

I'd like to create a userguide for the application I'm building using the Kohana framework, and I'm wondering if there's a way I can use the Kohana userguide module for this purpose.
I understand how to add userguide info for new modules that I create, and how to include my classes in the API, but I want to build a second, separate userguide for the actual application user, as opposed to the app developers.
At first, I thought I'd just try adding app help pages to the main userguide at APPPATH/guide. I tried adding a "application/guide" directory, and put a file in there called menu.md, but that just ended up replacing the Kohana menu in the userguide. After renaming the file to menu.myapp.md, it doesn't show up at all.
So then it occurs to me that I could simple edit modules/userguide/guide/menu.md to add sections for my app, and likewise add markdown files for each app component. But really it would be much better to have a completely separate userguide for app users since the Kohana documentation isn't relevant for them.
What's the best way to go about this? Should I create a duplicate of the entire userguide module and modify the routing, &c.? Or is there some way to set up both userguides using the one version of the module? Or am I barking up the wrong tree altogether? Is there some other module/approach that would be better for building "Help" pages for the app?
Thanks in advance for your help!

Yes, you can make docs for your application with the userguide. If you want examples, check out these links:
https://github.com/zombor/Auto-Modeler/blob/master/config/userguide.php
https://github.com/zombor/Auto-Modeler/tree/master/guide/auto-modeler
Note that you'll still get "api docs" and everything else, unless you change the config to hide them.

Related

Shopify Interact with product page HTML via app

We plan to create a Shopify app but we face some problems to find in documentations how to interact with pages.
I`m not sure we must ask every time users to add codes and etc, so I need to know if I miss something.
I need to interact with the product pages in Shopify from an app.
I search and read all the web for this and everything is how to start but not the actual examples.
I know for the ScriptTags and how to include them but that is.
If someone can give me a simple example of how for example to hide the Buy button and insert something on instead.
I know how to select it with the default theme with JQuery but what about all other themes?
There are two ways to interact with the front page:
1) Inject some code in the page ( the live one )
2) Use ScriptTag as you mentioned.
The code injection script will modify the product template for example and inject your code if you like to do this automatically or you can instruct the user to do so on their own, but if they are not code savvy there might be issues.
In addition this code will live only on the live theme in most cases. And if the user likes to delete your app at a specific time you must be sure to write the logic in such way that it won't affect the site if your app is no longer present ( since it will be really hard to clean up the files once you add the code automatically )
For this approach you will need to use the Asset API.
You will need to get the content of the file with a GET request to the file and make a put request in order to update it.
The better approach is to use ScriptTag API.
This will allow the use of a script file that will be attached on EVERY theme. This will not modify the theme files in any form or shape.
It seems that this is the approach that you are looking for.
Please have in mind that you will be the one hosting the file from your app so pretty much you can write what ever you like there. So if you like to use jQuery you must be sure that the themes have included jQuery or you will have to add the jQuery core code inside your script.
As for how to write a script tag, there is a pretty straightforward documentation here: https://help.shopify.com/en/api/reference/online-store/scripttag#create-2020-01

Joomla: Allowing a user to upload an image

Alright so I learned that to have an upload button on a page, what you do is basically call a php file (call is upload.php) that would upload a file to the server. I have no idea where I am supposed to put the php file inside the server so I can call it.
I feel stupid because I can't find any answers online. I am getting very frustrated and confused because I am told I need to create a database but I have no idea how to edit a database in Joomla. I took a class in SQL so I don't have to learn about that. I just don't know where it is. I was also told I need to make a component. But this is confusing because all I want to do is have an upload button that will upload an image to the server.
I understand your frustration. I've got the basic idea on what you are trying to do. Here are a couple of options:
You might wanna take a look at Joomla! Extensions Directory ™. You might just find there a component or a module that already does this for you.
If you want to do it on your own, than you need to create a small module or a component inside Joomla! Please refer to the Joomla! Documentation or tutorials on this topic. Please note that you won't get this working instantly, because you first need to understand how Joomla! works. So your upload.php file will go in your module / component files. I don't think you need to do any SQL.
Now the part with "allowing a user" is a bit confusing... you want to "allow" any user to upload things to your server or just let's say, registered users? Generally uploading scripts need to be very strong from the security point of view. If this is the case, that you need to do a search for Joomla! ACL
You can simply create a form and add the "media" field type.
http://docs.joomla.org/Standard_form_field_types
You can also opt for the "file" field types to allow different types of fields.
Both fields can be added using the Joomla Component Creator: http://www.notwebdesign.com/joomla-component-creator/
And you might also want to take a look at K2 which has an excellent image upload functionality that allows scaling of images into three different sizes.

Where to place "common" classes in YII Framework structure?

I need to create a few classes and would like some help on where this would go in the YII Framework. I know if I create a Model, it must go in the "models" directory. And by the same logic I know where "views", "controllers" etc would go. However, where would the following be placed in my web application:
A class that contains a variety of "number" functions such as currency conversion, metric conversions etc?
A class that interacts with a REST API? (It interacts with the database)
Any tips?
To get started with adding custom classeses on YII you can check below link.
http://www.yiiframework.com/wiki/165/understanding-autoloading-helper-classes-and-helper-functions/
Hope it'll help you to start.
You can find an example here, it is pretty detailed in my opinion:
The directory structure of the Yii project site
Usually you can use any PHP class in within Yii. You can place it in the models folder (alongside the Yii generated models) and access them directly like so:
$myclass = new MyClass;
$myclass->methodname;
Alternatively (or if you run into any issues), you have can place it anywhere in your directory structure and include it in the main index.php (in the root) like so:
$myclass = dirname(__FILE__).'/myclass.php';
require_once($myclass);

Multiple modules in a page ZF2

I'm using Zend framework 2 and I want to load several modules in one URL... but i don't know how to do that, I tried to play with route but nothing worked...
So here I am!
Thanks for helping :)
The quick answer is that you need to choose (perhaps create) ONE module and define the appropriate url route in there, then reference your other modules using the service manager and view helpers from your controller function and view respectively. So it all orients around a single controller function which makes calls to the other modules.
If you still need help with this let me know and I'll try to find you some code examples by the end of the weekend. Also, let me know exactly what you're trying to do (partly so I can help but partly out of curiosity).

How do I manage assets in Rails 3.1?

OK, so I'm starting a new project using Rails 3.1 and I'm new to CoffeeScript.
Anyway, I like the idea of having asset files representing controllers but what if I only want the JS to render when the controller is called?
For example, I have a controller called Game. In my games.js.coffee file, I put some code in there and it's called for every page request. Even pages that have nothing to do with Games.
In Rails 3.0.7, what I would do is put a yield(:js) in the application erb file and then call content_for(:js) in my Games#action view. That way, only the js that was needed for that controller was loaded.
Or, am I going about this the wrong way? Is it better to have ALL js code loaded and cached for every page request to improve performance?
Thanks for any suggestions.
Is it better to have ALL js code loaded and cached for every page request to improve performance?
Basically, the Rails team decided that the answer is usually "yes." Most sites work best with just a single (minified) JS file, which you get by default in Rails 3.1. That way, once the user has accessed a single page of your site, all other pages will load quickly, since all the JS has been cached.
If your site has a huge amount of JS (think Facebook), then I'd suggest architecting your site to load rarely-used JS code asynchronously, using a library like RequireJS. Otherwise, I wouldn't bother loading different code under different controllers; it's a lot of extra work for a marginal benefit.
Take a look at this plugin, I think it solves your problem: https://github.com/snitko/specific_assets