appRain is one of the first officially released open-source content management frameworks (CMF). CMF is a new, web engineering concept where a content management system (CMS) and a rapid development framework perform side-by-side to produce endless varieties of output in a very limited time.
appRain is developed on a daily basis, drawing on extensive project experience. A common problem that we all face in a framework is that we need to re-develop some common modules in each project. With content management systems, we sometimes get stuck driving our development based on the strict conventions the system enforces. Why is there no CMS integrated with a framework? This is the question that gave birth to appRain.
Content management systems and frameworks are very popular in web development. These two technologies work in different ways. One is used for rapid development, the other for more customized output. appRain merges these two technologies. appRain is fast, flexible, and makes it easy to complete tasks in a very short time period. It can be expanded and scaled.
The tools in the CMS component of appRain are all configurable, making development faster. It helps to avoid repeating tasks. The framework component is used when it becomes too difficult to complete your requirements using the CMS tools. The framework contains all of the core programming tools.
appRain aims to make creating web technology simple and easily optimized.
InformationSet and CategorySet are two common tools used to manage data. These two methods reduce development time significantly.
InformationSet automatically creates interfaces for data entry controlled by a preconfigured validation matrix. This is a single database table managed by an XML file where all database fields are defined separately with parameters like
InformationSet can adjust when the definition of a field changes. In that case, the database user needs the necessary permissions.\n\nAn InformationSet can be linked with other InformationSets or CategorySets for joining, and it also creates linked input tags like Drop Down and Check Box, etc.\n\nCategorySet works similarly to InformationSet, but it specifically works to manage recursive parent-child relations. Generally, it is used to categorize any InformationSet data.
A rich library of functions has been developed to work with InformationSet and CategorySet.
When developing websites, working with themes is a typical task. It could be the website's front end or the admin area. Let's take a look at how to create a front-end theme.
All themes are created inside the view folder of the development folder. Create a directory in the location below if the theme's name is Rainy Day.
development/view/rainyday
There are a few fundamental folders that must be created in the view folder; let's go over each one individually.
Definition:
Definition is a required folder that stores a theme's core resources. First of all, the info.xml. It contains basic boot files and developer's information.When you open a file from an existing theme, you may find the XML with the nodes listed below.
{{name=UI type=staticpage name=theme-info-xml-field-information-dp autoformat=off}}
The logo serves as the theme's thumbnail in the theme gallery. The name of the logo should match the info.xml definition.
register.php is the class file defined in info XML. As per Apprain convention, the class name comes with the path of the file. The class contains the basic callback function listed below
before_theme_load($Send=null)\nafter_theme_load($Send=null)\nbefore_theme_install($Send=null)\nafter_theme_installed($Send=null)\non_theme_removed($Send=null)
Before the theme loads, we frequently change the layout based on what the page is showing. For an illustration, see the sample below.
\nif(App::Config()->isPageView()){\n $Send->layout = App::Config()->Setting('site_pageview_layout','right_column_layout');\n}\n
The themesettings.xml file contains any settings that a theme could require from the user. The field that a user must edit in order to change the theme might be specified. The settings can be accessed via the admin panel from Preferences > Theme > Settings.
Layout
Through layout, we define the basic page structure; all are the.phtml files stored in the layout folder, and the system loads default.phtml by default; however, when a different layout is needed, we can set it like $send->layout = 'simple' from the register callback method.
Below are some important points to be noted
$this->callElement("header_info") :\nThis is to call an element from the elements folder that sets the header of the HTML documents.
$this->callElement("header_info")
$this->fetchAddonlibs();\nLoad all client-side addons generally based on HTML, Javascript, and CSS
$this->fetchAddonlibs();
$this->callElement("header"), $this->callElement("footer")\nIt is advised to keep the header and footer in these two elements that eventually help to edit from the admin panel.
$this->callElement("header"), $this->callElement("footer")
$content_rendered\nThis variable contains the output of the page view that we have defined in the controller function as per the conventions of MVC. So when we browse different web pages, the content changes and is placed in the layout. more, as you can see in the documentation.
$content_rendered
Elements:\nElements are split-view files that can be included into other pages as needed. The method for rendering an element's content is shown below.
$this->callElement([Element Name]) for example echo $this->callElement("quicklinks")
$this->callElement([Element Name])
echo $this->callElement("quicklinks")
Home, Page\nThese are two folders created for Home and Page Controller in the development folder as a standard. All the files inside are templates for Action Method.
index.html in the home folder is the default page, as it's defined in Router (boot_router.xml). On the other hand, view.phtml in the pages folder is to display content from the Page Manger in the admin panel.
More pages can be created in the development area or from a component that loads as per the browsed webpage address following the convention of the MVC pattern
UI Hook
UI Hooks are placeholders to render content from external modules like Component, Page Manager, and so on. A theme contains basic UI hooks defined in info.xml by the theme developer. Then the end user can easily place content on a webpage from the Page Manager in the admin panel.
As these hooks cannot be seen without going into code, the end user can go to Preferences > Configuration and set the parameter Show Hook Positions to "Yes" to view the positions in the front end to select where to put the content. See the instance below; more illustrations can be found in the documentation.
App::Hook('UI')->Render([Hook Name]); for example App::Hook('UI')->Render('quick_links_top');
App::Hook('UI')->Render([Hook Name]);
App::Hook('UI')->Render('quick_links_top');
External Resouces
For most of the theme, we need to store CSS, JavaScript, and other theme files and access them from the development area. Generally, we store those files in the themeroot folder in webroot; for example, see below location
webroot/themeroot/rainyday
Note: Generally, we save a default.css file in a CSS folder that we can modify from the admin panel in the theme area.
To retrieve resources from the theme folder that is presently active, use the skinUrl function. See examples below.
echo App::Config()->skinUrl("/css/default.css");\necho App::Config()->skinUrl("/images/banner.jpg");
One more function that will help you is to load resources uploaded by file manager using filemanagerUrl. See below example:
echo App::Config()->fileManagerUrl("/logo.png");
You can read a lot about theme development in the manual.
appRain has a detailed manual to read online or download. We always encourage sending your valuable feedback to info@apprain.com
Online Manual
CHM is the standard help format for a windows desktop application. The output is a single file with extension *.chm.
Download
Adobe Portable Document Format (PDF) is a platform independent file format. This is ideal for Device and Print.
This type is a cross-platform e-book standard created by the IDPF, which is supported by Apple iBooks, Andriod Tablets/smartphones and many other e-readers on windows, Mac OSX, iOS and Linux.
This format is an ideal to illustrate web-based application, to publish documentation to the internet, intranet or CD-ROM
Windows e-books are stand-alone Windows executable with HTML formatted texts and images. This output format is great for CD-ROM presentations.
\n Version sysConfig(''APPRAINVERSION''); ?> has come up with many fixes with the new version of PHP.This release includes two components: ethincal and messenger, which play a significant role in development.\n
Copyright (c) appRain CMF (http://www.apprain.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\n Are you ready to write some XML tags? It''s pretty simple, right? XML-based coding will enable significant advancements in appRain. \n You can create an admin panel interface, configure software, work with databases, and many other things.\n
\n appRain is the best fit for your enterprise projects with less effort.
">Concept of development.
Website or enterprise project, plan it first properly to make the development faster and more convenient. First, use the built-in tools available in CMS. Secondly, use the configureable tools in Framework, and then go for coding for customized development in MVC.
appRain enables the maximum amount of customized development through its standard libraries.
Quick Start
Convert your work into APIs; it''s very easy. The application can be securely integrated with any other system on any platform.
Ethical is a security plugin in-built with version 4.0.5 that also works as an API layer. Install the component, create a service helper, and that''s all it takes to make the method callable from other systems through user authentication and a secure token.
Ethical Component
appRain is one of the first officially released Opensource Content Management Framework (CMF). CMF is a new web engineering concept where "CMS (Content Management System)" and "Framework" perform together to produce endless varieties of output in a very limited time.
appRain, published with lots of extensive features to reduce our development work time. It satisfies both Client and Developers with a safe and quality output.
Page Manager is a frequently used module to create new pages on the website. You will find it in the first tab after logging into the Admin Panel.
Use the link page section to assign your page to different places on the website. You will get a selected section to assign the page in the menu under Quick Links. Holding the CTRL key and clicking with the left mouse button selects multiple hooks.
You can select the option from the drop-down beneath the hook list. The Text option will place the page content in a particular area of a page. Hyperlinks can be of two types; one is Smart Link, which generates a page with an optimized URL. The other is a direct link to the page.
A large text box is available to renter a page in a User Defile Hook defined in the theme; each hook name must be comma separated.
It is really important to format the page well. Use the common field section to set the page title and other meta information.
The Sort Order field is helpful to manage the order of the page in the website menu and quick links.
Dynamic pages are great features in Page Manager for writing server-side code from the interface. All resources should be accessible through App Factory. Because this factory will make all your resources available in the script, To work in a dynamic page, you should be familiar with the system's internal coding structure. One important tip: dynamic pages render only under static pages. Click on the "Page Code List" button, and the list will pop up. Also, a static page can be rendered alongside another static page. Just paste the page code inside the content.
For developers, there is a detailed module to execute all operations. This module helps to work with pages in the MVC model. Moreover, it has different hooks to register Page Manager in a component in different events.
How a project's development starts basically depends on the demands of the requirements, but typically it is either front end of the website or in the admin panel.
First, log in to the admin panel (see the link in the footer) and go to "Preferences > Admin Settings," where you can change basic information. Moreover, check all the other menus under "Preferences" to explore other options. Among them, theme is one of the options that helps to change the installed themes.
Note: Two basic themes have been released as samples with the installation of version 4.0.5. These themes have been given as a sample, but other themes may vary depending on the theme developer. How to develop a theme has been described in the Theme Development Section.
Customize website content
Login to the admin panel and activate the theme "White Cloud" from the below location
Preferences > Theme.
We can use Page Manager to modify the content of the website. Go to the below location to modify website page content.
Page Manager > Static Pages > Manage Pages
For this theme, Page Manager will help modify the HTML content as well. Go to the dynamic pages section to modify the content from the below location.
Page Manager > Dynamic Pages > Manage Pages
White Cloud is a special theme that saves all HTML content to the database and allows modification from the admin panel. However, because HTML is generally saved in the file system, you should find it in the below folder. To simulate this, you can use the Rainy Day theme.
Note: Dynamic pages allow HTML and PHP to be executed, and it is recommended that Apprain Factory be used to access all internal resources.
Create your first controller and page:
Creating a controller and a page is generally the first step of a project to create a webpage and process data. More detail will be in the documentation, but we will see a simple simulation here. A controller is a class containing a set of methods; a method is called an action method when we add the word "Action" at the end of the function name. As a result, it gains the ability to display a page and interact with external calls. Create the below class in the "development/controllers" folder with the name helloworld.php.
\nclass helloworldController extends appRain_Base_Core\n{\n public $name = 'helloworld';\n public function mypageAction(){}\n}
Now create a folder called "helloworld" in your theme directory; for example, if the theme name is White Cloud, then the location will be
/development/view/whitecloud/
Inside the folder, create a file with the name "mypage.phtml," which is basically the name of the action method, and put some content there.
Now you can browse the page with the below convention:
[domain name]/[controller name]/[action method name]\nFor example www.example.com/helloworld/mypage
This is a minimal example of a controller, and there are many more things to do, which can be found in the documentation.
Page in Admin Panel:
After creating a page to render in the admin panel with user authentication, it is widely used in enterprise projects. To render a page in admin panel simple add a tab name in action method
\npublic function mypageAction()\n{\n $this->setAdminTab('page_manager');\n}
Now if you browse the same page, it will be rendered in the admin panel. For further development, see the documentation.
More Quick Points
Apprain is a robust platform for development that optimizes effort and time.
After setting up Apprain , start development with all interface-based tools like Page Manager, Theme, etc. This is the primary stage of your start-up.
After that, find components that fit you and install them. This will save you a lot of time.
Next, work with XML to manage your development to save time. Below are some common sections to work with that are found in "development/definition.".
Now start working with the MVC pattern to meet order requirements. Configure one or multiple databases to work with simultaneously.\nThis is highly recommended: develop new components for specific requirements. Each component will enrich your personal archive because it is reusable. A component uses any core resource by using a hook.
However, appRain has both ready-made and unstitched tools; we just have to use them as per need.
\n The new release focused on security and data interfacing through the Ethical Component.\n
Working with appRain is all about planning our work. Split the work into three major phases. First, use all CMS tools to execute your first line of defense. Secondly, when you need to work with databases and other customized requirements, switch to using Framework Ready tools. Finally, start coding to do your job. Keep the source code untouched in the core library so applications can be upgraded in the next release.
appRain is well-equipped for enterprise project development, making it faster and more secure; appRain ERP is an example. All that remains is to select the appropriate tools.
Helps to work with database tables without manual intervention.
It aids in categorizing information for more meaningful use.
Use to manage your content and publish to present on your website
Write code from the interface to prepare content for Page Manager.
Always try to make your work reusable. Each component works independently and is reusable, so create a component when the requirement is new. \n Use all resources through App Factory, staying within the component folder; if needed, access other components resources or send back references using Hooks.
App Factory helps manage all resources in the system. It is recommended to use that to ensure compliance.
App
App::Module(''Hook'') is primarily used in components to register all resources and utilize them in a standalone manner.
App::Module(''Hook'')
\n Need any help? Shoot us a mail at info[at]apprain.com\n
\nSee the Site Setting, Interface Builder, and ACL sections; those will make your development most customizable.
\nIf multiple applications run in a single organization, then try to avoid going through multiple instances of installation. First, configure the router to merge multiple applications with database profiling and give distributed access to the end user by specifying a domain or sub-domin.
\n Always do component-based development; save your work for future use. Develop hooks for your own component and open it up for other developers to use internally.\n
\n appRain is currently hosted on two websites, which are www.apprain.org and www.apprain.com. New releases, developer materials, and all other information are available on the ORG website. The COM website, on the other hand, offers support for the appRain team''s ERP.\n The context here is that the ORG is practicing CSR with the support of COM in return enjoys all the releases from the ORG.\n
Here, creating an API is fairly easy. It is prepared in two steps.
Step 1:\nActivate the Ethical component under the Applications page in the Admin Panel after logging in.
Step 2: \nGo to any of your components and create a helper called service. Now each function in the helper serves as an API call.
After the two steps, go to user management and create a user because credentials are required to create a token for the call to the API. Now let's look at a step-by-step guideline.
Activate the Ethical Component:\nLog in to the admin panel, go to the Applications menu, find the ethical component, and activate it if it is not already activated.
Admin Panel > Applications > Ethical (Activate)
Note: The Messenger component should also be enabled so that we can replicate the API there.
Create Api User: \nGo to User Management and create a user to use the API service. For example, the user name is "apiuser" and the password is "Api@24H7"
Create Service\nGo to the following location in the messenger component's helper directory.
component/messenger/helpers
Create the file service.php and the following classes if they don't already exist.
\nclass Component_Messenger_Helpers_Service extends appRain_Base_Objects\n{\n}
Now let's create the function below in the service class as test service.
\npublic function getMyPetName($data){\n $type = isset($data['type']) ? $data['type'] : '';\n switch($type){\n case 'animal':\n return array('state'=>'100','petname'=>'Dog');\n case 'bird':\n return array('state'=>'100','petname'=>'Cockatiel'); \n default:\n return array('state'=>'101','petname'=>'');\n}
Thats all our API server has ready; if we want to know an animal, it should return "Dog" and for a bird, it will return "Cockatiel". In both cases, it will return the state code "100". For other requests, it will return state code "101". It is a sample setup, but we can do it as needed.
API Call
For an API call, we have two basic addresses: one for authorization and another for the final call to receive data. For example, if project address is www.example.com the authentication and data exchange addresses will be as follows:
https://www.example.com/ethical/auth\nhttps://www.example.com/ethical/exchange
Crate Token:\nFollow the below script to create an authentication token
\n$AUTH_URI = "https://www.example.com/ethical/auth"\n$DATA_EXCHANGE_URI = "https://www.example.com/ethical/exchange"\n\n$data = array(\n "username"=>"apiuser",\n "password"=>"Api@24H7"\n);\n$response = httpPost($AUTH_URI ,$data);\n$result = json_decode($response,true);\n\n$token = $result['token'];\n$timestamp = $result['timestamp'];
Do API Call: \nIn the last step, we received a token and a time stamp that we will use to send the reques. There are specific parameters that must be sent during a call; see the list of important information below.
\n$post = array();\n$post['token'] = $result['token'];\n$post['timestamp'] = $result['timestamp'];\n$post['com'] = 'Messenger';\n$post['action'] = "getMyPetName";\n$post['type'] = "animal";\n\n$response = httpPost($DATA_EXCHANGE_URI ,$post);\n$result = json_decode($response,true);\nprint_r($result)
Return value
\nArray\n(\n [state] => 100\n [petname] => Dog\n [token] => ezEyMzQ1Njc4OTAxMjoyOjE2ODE5MjM3NjJ9\n [timestamp] => 1681923762\n [status] => 1\n)
Now see the full script with the additional calls
\n$AUTH_URI = "https://www.example.com/ethical/auth";\n$DATA_EXCHANGE_URI = "https://www.example.com/ethical/exchange";\n\n## Step 1: Create the token\n$data = array(\n "username"=>"apiuser",\n "password"=>"Api@24H7"\n);\n$response = httpPost($AUTH_URI ,$data);\n$result = json_decode($response,true);\n\n$token = $result[''token''];\n$timestamp = $result[''timestamp''];\n\n## Step 2: \n# Call 1\n$post = array();\n$post[''token''] = $result[''token''];\n$post[''timestamp''] = $result[''timestamp''];\n$post[''com''] = ''Messenger'';\n$post[''action''] = "getMyPetName";\n$post[''type''] = "animal";\n\n$response = httpPost($DATA_EXCHANGE_URI ,$post);\n$result = json_decode($response,true);\nprint_r($result);\n\n# Call 2\n$post = array();\n$post[''token''] = $result[''token''];\n$post[''timestamp''] = $result[''timestamp''];\n$post[''com''] = ''Messenger'';\n$post[''action''] = "getMyPetName";\n$post[''type''] = "bird";\n\n$response = httpPost($DATA_EXCHANGE_URI ,$post);\n$result = json_decode($response,true);\nprint_r($result);\n\n# Call 3\n$post = array();\n$post[''token''] = $result[''token''];\n$post[''timestamp''] = $result[''timestamp''];\n$post[''com''] = ''Messenger'';\n$post[''action''] = "getMyPetName";\n$post[''type''] = "other";\n\n$response = httpPost($DATA_EXCHANGE_URI ,$post);\n$result = json_decode($response,true);\nprint_r($result);\n\n\n## Submit request\nfunction httpPost($url, $data)\n{\n $curl = curl_init($url);\n curl_setopt($curl, CURLOPT_POST, true);\n curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));\n curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\n $response = curl_exec($curl);\n curl_close($curl); \n return $response;\n}
\n Duis arcu elit, rutrum a interdum quis, vulputate et diam. Mauris eleifend cursus tortor. Sed ut leo quis nisi vehicula sagittis. Maecenas sed nisl at quam vulputate mattis in nec sapien. Etiam vel massa in eros sodales bibendum. Vestibulum ut urna cursus lectus sodales facilisis vel vitae sem. Aenean a nisl ut nulla ullamcorper tristique non quis sem.\n \n Vestibulum at orci a velit varius\n 45/B consectetur quis sit amet\n diam. \n phasellus@eget felis.purus.