-
Posts
36 -
Joined
-
Last visited
-
Days Won
3
Reputation Activity
-
Rodrigo got a reaction from tenaki in Fully Custom Blesta Order Page
Hi,
Finally I've managed to make the custom order page design by applying a hack to order form controller that let me to assign an specific blesta template for this order page without changing the template of any other page.
Maybe this would apply for a feature request, because with the current system we can't do a full order page customization
-
Rodrigo got a reaction from lamlai in [Blesta 3.2.1-3.5.1] Universal Module Workaround: Show Service Fields At Client Panel
Hello,
As other users reported in the forum, this issue is making troubles for services that doesn't have proper provisioning modules.
By doing the following changes, a Tab will appear at client's manage service page, showing all the service fields that have the public_ tag on their name.
Instructions:
1. Open components/modules/universal_module/universal_module.php
Find:
private function isUrl($str) { return preg_match("#^\S+://\S+\.\S+.+$#", $str); } Add After:
/** * Returns all tabs to display to a client when managing a service whose * package uses this module * * @param stdClass $package A stdClass object representing the selected package * @return array An array of tabs in the format of method => title. Example: array('methodName' => "Title", 'methodName2' => "Title2") */ public function getClientTabs($package) { return array( 'moreinfo' => array('name' => "More Info", 'icon' => "fa fa-gears") ); } /** * The More Info tab * * @param stdClass $package A stdClass object representing the current package * @param stdClass $service A stdClass object representing the current service * @param array $get Any GET parameters * @param array $post Any POST parameters * @param array $files Any FILES parameters * @return string The string representing the contents of this tab */ public function moreinfo($package, $service, array $get=null, array $post=null, array $files=null) { $row = $this->getModuleRow($package->module_row); $out = ''; $servicefields = array(); foreach ($row->meta as $key=>$value ) { if (strpos($key, "service_field_name") !== false) { // Here we match the service field label with their key and value foreach($service->fields as $field) { if($field->key == $value) { $name = 'service_field_label_' . str_replace('service_field_name_', '', $key); $servicefields[] = array("label" => $row->meta->$name, "key" => $value, "value" => $field->value); } } } } foreach($servicefields as $field) { // Filter out for showing only public fields if(strpos($field['key'], "public_") === 0 ) { $out .= "<p><b>". $field['label'] . ":</b> " . $field['value'] . "</p>"; } } return "<h4>Service Information</h4><br />" . $out ; } 2. Make sure that the service fields that you want to show to the client start with "public_" prefix
Preview
Setting up public service fields
Service fields being shown on client's "Manage Service" page
Download drop-in replacement file (if you don't want to manually add the above lines) (Only for Blesta 3.2.1): universal_module.php
Caution:
This file will be overwritten if you update Blesta and the Tab will disappear (there is no other risk or any service data loss). If you change the service field name of a existing field, the data will not be preserved (bug?)
EDIT: This still works for Blesta 3.5.1. I'm not sure if it's still needed, but I'm already using it for my production blesta website so there's no way back
-
Rodrigo got a reaction from jobplease in [Blesta 3.2-3.5.1] How To Make Static Pages By Modifying Portal Plugin
Hi,
I'm sharing a quick method for making custom static pages in blest system without any additional plugin. Please consider that any future update would require to take care of the changes made as they can be erased.
In this example I'll be doing a static page that will be located in your_blesta_location.com/services
1.1 Creating a static page with custom HTML
1. Open plugins/cms/controller/main.php
Find:
else { $this->redirect($this->base_uri); } Replace for:
else { switch($uri) { case 'services': $this->structure->set("page_title", "*** INSERT PAGE TITLE ***"); $this->structure->set("title", "*** INSERT TITLE SHOWN ON PORTAL TEMPLATE ***"); // Placeholders won't work with this method, so let's use variables $url = rtrim($this->base_url, "/"); $blesta_url = $this->Html->safe($url . WEBDIR); $html = <<<EOT <div class="col-md-4 col-sm-6 portal-box"> <a href="{$blesta_url}services> <div class="well"> <i class="fa fa-cogs fa-4x"></i> <h4>Foo</h4> <p>Bar.</p> </div> </a> </div> EOT; $this->set("content", $html); break; default: $this->redirect($this->base_uri); } } You can repeat the php case for making all the static pages you want, putting HTML between the EOT marks (There should be no space or characters after EOT; mark). If you don't like the broken indentation you can try another methods for doing multi line strings in PHP, but I think using nowdoc is more easy when you need to insert html.
1.2 Adding custom meta tags to the new static page (optional)
1. Open plugins/cms/controller/main.php
Find
$this->set("content", $html); Add Before:
$metatags = <<<EOT <meta property="og:title" content="foo"/> <meta property="og:description" content="bar."/> <meta property="og:image" content="baz"/> <meta property="og:url" content="http://www.example.com/services"/> EOT; $this->structure->set("metatags" , $metatags); 2. Open /app/views/client/bootstrap/structure.pdt (or in your own template)
Find
<meta name="viewport" content="width=device-width, initial-scale=1.0"> Add after
<?php echo $this->Html->ifSet($metatags) ?> Dev note: this could be easier if could find a way to get structure protected property values, then concat the metatags to an existing variable like $custom_head (Is there a method like $this->structure->get()?)
Also, don't forget that the Portal plugin is being developed for being a fully functional CMS system, so this would not be needed in the future.
Here is my result, I'm linking this custom static page from the blesta portal main page for linking to different order pages (currently in design and module coding process, blesta flexibility is awesome)
Result:
Setting what Facebook shows by modifying meta tags
I hope somebody finds this useful
Bye
EDIT: fixed a detail in $url definition
EDIT2: Added how to add custom html into <head>
EDIT3. Confirming that this still works for Blesta 3.5.1
-
Rodrigo got a reaction from swemed in [Blesta 3.2.1] Order Pages Spanish Language Pack [100%]
Hi,
As the current blesta spanish language pack doesn't include the order page translations (I don't know if it's a bug or the translation is just incomplete), I made a word by word translation for all the included order pages in blesta
Requirements:
-Blesta Spanish Translate Pack Installed (es_es)
Translated Order Pages:
AJAX Wizard Standard
How to Install: Uncompress the archive on blesta root folder
Download: orderpages_spanish_langpack.tar.gz
Feel free to include this language pack onto existing blesta package or translation status. Maybe I'll release more goodies as I prepare my blesta install for production environment
-
Rodrigo got a reaction from flangefrog in Fully Custom Blesta Order Page
Hi,
Finally I've managed to make the custom order page design by applying a hack to order form controller that let me to assign an specific blesta template for this order page without changing the template of any other page.
Maybe this would apply for a feature request, because with the current system we can't do a full order page customization
-
Rodrigo got a reaction from interfasys in [Blesta 3.2.1-3.5.1] Universal Module Workaround: Show Service Fields At Client Panel
Hello,
As other users reported in the forum, this issue is making troubles for services that doesn't have proper provisioning modules.
By doing the following changes, a Tab will appear at client's manage service page, showing all the service fields that have the public_ tag on their name.
Instructions:
1. Open components/modules/universal_module/universal_module.php
Find:
private function isUrl($str) { return preg_match("#^\S+://\S+\.\S+.+$#", $str); } Add After:
/** * Returns all tabs to display to a client when managing a service whose * package uses this module * * @param stdClass $package A stdClass object representing the selected package * @return array An array of tabs in the format of method => title. Example: array('methodName' => "Title", 'methodName2' => "Title2") */ public function getClientTabs($package) { return array( 'moreinfo' => array('name' => "More Info", 'icon' => "fa fa-gears") ); } /** * The More Info tab * * @param stdClass $package A stdClass object representing the current package * @param stdClass $service A stdClass object representing the current service * @param array $get Any GET parameters * @param array $post Any POST parameters * @param array $files Any FILES parameters * @return string The string representing the contents of this tab */ public function moreinfo($package, $service, array $get=null, array $post=null, array $files=null) { $row = $this->getModuleRow($package->module_row); $out = ''; $servicefields = array(); foreach ($row->meta as $key=>$value ) { if (strpos($key, "service_field_name") !== false) { // Here we match the service field label with their key and value foreach($service->fields as $field) { if($field->key == $value) { $name = 'service_field_label_' . str_replace('service_field_name_', '', $key); $servicefields[] = array("label" => $row->meta->$name, "key" => $value, "value" => $field->value); } } } } foreach($servicefields as $field) { // Filter out for showing only public fields if(strpos($field['key'], "public_") === 0 ) { $out .= "<p><b>". $field['label'] . ":</b> " . $field['value'] . "</p>"; } } return "<h4>Service Information</h4><br />" . $out ; } 2. Make sure that the service fields that you want to show to the client start with "public_" prefix
Preview
Setting up public service fields
Service fields being shown on client's "Manage Service" page
Download drop-in replacement file (if you don't want to manually add the above lines) (Only for Blesta 3.2.1): universal_module.php
Caution:
This file will be overwritten if you update Blesta and the Tab will disappear (there is no other risk or any service data loss). If you change the service field name of a existing field, the data will not be preserved (bug?)
EDIT: This still works for Blesta 3.5.1. I'm not sure if it's still needed, but I'm already using it for my production blesta website so there's no way back
-
Rodrigo got a reaction from Daniel B in Fully Custom Blesta Order Page
Hi,
Finally I've managed to make the custom order page design by applying a hack to order form controller that let me to assign an specific blesta template for this order page without changing the template of any other page.
Maybe this would apply for a feature request, because with the current system we can't do a full order page customization
-
Rodrigo got a reaction from Blesta Addons in A Little Project :)
After developing a blesta payment gateway and modifying multicraft module enough for making a provisioning module for a totally different service, I think that blesta is a *very* powerful platform for managing service from the service itself to the billing.
I have a custom made GSP panel for my services, but as I'm preparing blesta for putting it to my production environment, I find that migrating the whole panel as a blesta module is a very attractive choice, as it can be more comfortable for users (less login combinations to remember (if you don't do something like a shared login), a single portal to manage all.
You should really consider doing a module instead of a whole panel, but if you are going to sell and license your panel, you might want to keep it standalone.
As a tip for developing, just be paranoid about user input, it always work lol (and you should consider using a WAF like apache's mod security just for prevention)
-
Rodrigo got a reaction from Michael in A Little Project :)
After developing a blesta payment gateway and modifying multicraft module enough for making a provisioning module for a totally different service, I think that blesta is a *very* powerful platform for managing service from the service itself to the billing.
I have a custom made GSP panel for my services, but as I'm preparing blesta for putting it to my production environment, I find that migrating the whole panel as a blesta module is a very attractive choice, as it can be more comfortable for users (less login combinations to remember (if you don't do something like a shared login), a single portal to manage all.
You should really consider doing a module instead of a whole panel, but if you are going to sell and license your panel, you might want to keep it standalone.
As a tip for developing, just be paranoid about user input, it always work lol (and you should consider using a WAF like apache's mod security just for prevention)
-
Rodrigo got a reaction from serge in [Blesta 3.2-3.5.1] How To Make Static Pages By Modifying Portal Plugin
Hi,
I'm sharing a quick method for making custom static pages in blest system without any additional plugin. Please consider that any future update would require to take care of the changes made as they can be erased.
In this example I'll be doing a static page that will be located in your_blesta_location.com/services
1.1 Creating a static page with custom HTML
1. Open plugins/cms/controller/main.php
Find:
else { $this->redirect($this->base_uri); } Replace for:
else { switch($uri) { case 'services': $this->structure->set("page_title", "*** INSERT PAGE TITLE ***"); $this->structure->set("title", "*** INSERT TITLE SHOWN ON PORTAL TEMPLATE ***"); // Placeholders won't work with this method, so let's use variables $url = rtrim($this->base_url, "/"); $blesta_url = $this->Html->safe($url . WEBDIR); $html = <<<EOT <div class="col-md-4 col-sm-6 portal-box"> <a href="{$blesta_url}services> <div class="well"> <i class="fa fa-cogs fa-4x"></i> <h4>Foo</h4> <p>Bar.</p> </div> </a> </div> EOT; $this->set("content", $html); break; default: $this->redirect($this->base_uri); } } You can repeat the php case for making all the static pages you want, putting HTML between the EOT marks (There should be no space or characters after EOT; mark). If you don't like the broken indentation you can try another methods for doing multi line strings in PHP, but I think using nowdoc is more easy when you need to insert html.
1.2 Adding custom meta tags to the new static page (optional)
1. Open plugins/cms/controller/main.php
Find
$this->set("content", $html); Add Before:
$metatags = <<<EOT <meta property="og:title" content="foo"/> <meta property="og:description" content="bar."/> <meta property="og:image" content="baz"/> <meta property="og:url" content="http://www.example.com/services"/> EOT; $this->structure->set("metatags" , $metatags); 2. Open /app/views/client/bootstrap/structure.pdt (or in your own template)
Find
<meta name="viewport" content="width=device-width, initial-scale=1.0"> Add after
<?php echo $this->Html->ifSet($metatags) ?> Dev note: this could be easier if could find a way to get structure protected property values, then concat the metatags to an existing variable like $custom_head (Is there a method like $this->structure->get()?)
Also, don't forget that the Portal plugin is being developed for being a fully functional CMS system, so this would not be needed in the future.
Here is my result, I'm linking this custom static page from the blesta portal main page for linking to different order pages (currently in design and module coding process, blesta flexibility is awesome)
Result:
Setting what Facebook shows by modifying meta tags
I hope somebody finds this useful
Bye
EDIT: fixed a detail in $url definition
EDIT2: Added how to add custom html into <head>
EDIT3. Confirming that this still works for Blesta 3.5.1
-
Rodrigo got a reaction from PauloV in [Blesta 3.2.1] Order Pages Spanish Language Pack [100%]
Hi,
As the current blesta spanish language pack doesn't include the order page translations (I don't know if it's a bug or the translation is just incomplete), I made a word by word translation for all the included order pages in blesta
Requirements:
-Blesta Spanish Translate Pack Installed (es_es)
Translated Order Pages:
AJAX Wizard Standard
How to Install: Uncompress the archive on blesta root folder
Download: orderpages_spanish_langpack.tar.gz
Feel free to include this language pack onto existing blesta package or translation status. Maybe I'll release more goodies as I prepare my blesta install for production environment
-
Rodrigo got a reaction from ServZoo in [Blesta 3.2.1-3.5.1] Universal Module Workaround: Show Service Fields At Client Panel
Hello,
As other users reported in the forum, this issue is making troubles for services that doesn't have proper provisioning modules.
By doing the following changes, a Tab will appear at client's manage service page, showing all the service fields that have the public_ tag on their name.
Instructions:
1. Open components/modules/universal_module/universal_module.php
Find:
private function isUrl($str) { return preg_match("#^\S+://\S+\.\S+.+$#", $str); } Add After:
/** * Returns all tabs to display to a client when managing a service whose * package uses this module * * @param stdClass $package A stdClass object representing the selected package * @return array An array of tabs in the format of method => title. Example: array('methodName' => "Title", 'methodName2' => "Title2") */ public function getClientTabs($package) { return array( 'moreinfo' => array('name' => "More Info", 'icon' => "fa fa-gears") ); } /** * The More Info tab * * @param stdClass $package A stdClass object representing the current package * @param stdClass $service A stdClass object representing the current service * @param array $get Any GET parameters * @param array $post Any POST parameters * @param array $files Any FILES parameters * @return string The string representing the contents of this tab */ public function moreinfo($package, $service, array $get=null, array $post=null, array $files=null) { $row = $this->getModuleRow($package->module_row); $out = ''; $servicefields = array(); foreach ($row->meta as $key=>$value ) { if (strpos($key, "service_field_name") !== false) { // Here we match the service field label with their key and value foreach($service->fields as $field) { if($field->key == $value) { $name = 'service_field_label_' . str_replace('service_field_name_', '', $key); $servicefields[] = array("label" => $row->meta->$name, "key" => $value, "value" => $field->value); } } } } foreach($servicefields as $field) { // Filter out for showing only public fields if(strpos($field['key'], "public_") === 0 ) { $out .= "<p><b>". $field['label'] . ":</b> " . $field['value'] . "</p>"; } } return "<h4>Service Information</h4><br />" . $out ; } 2. Make sure that the service fields that you want to show to the client start with "public_" prefix
Preview
Setting up public service fields
Service fields being shown on client's "Manage Service" page
Download drop-in replacement file (if you don't want to manually add the above lines) (Only for Blesta 3.2.1): universal_module.php
Caution:
This file will be overwritten if you update Blesta and the Tab will disappear (there is no other risk or any service data loss). If you change the service field name of a existing field, the data will not be preserved (bug?)
EDIT: This still works for Blesta 3.5.1. I'm not sure if it's still needed, but I'm already using it for my production blesta website so there's no way back
-
Rodrigo got a reaction from Jonathan in [Blesta 3.2.1-3.5.1] Universal Module Workaround 2: Hide Certain Service Fields From Being Shown On Order Page
This patch should help to use the Universal Module for manually provisioning services that need administrators to fill service fields with data after they do the activation. e.g. dedicated servers, IP needs to be shown at control panel after the service is activated, but it shouldn't be asked at order page.
Requirements.
- Blesta 3.2.1
Update: I Upgraded to Blesta 3.5.1 and It worked fine
Instructions:
1. Open components/modules/universal_module/universal_module.php
Find:
public function getClientAddFields($package, $vars=null) { // Same as admin return $this->getAdminAddFields($package, $vars); } Replace with:
public function getClientAddFields($package, $vars=null) { $fields = new ModuleFields(); if (!isset($vars->meta)) $vars->meta = array(); if (isset($package->module_row) && $package->module_row > 0) { $row = $this->getModuleRow($package->module_row); // Set the module row, which will allow us to reference it later when getName() is invoked $this->setModuleRow($row); $row_fields = array(); if ($row->meta) { $row_fields = $this->formatModuleRowFields($row->meta); $field_data = array(); // Reformat package fields into a more usable format foreach ($row_fields['service_fields'] as $key => $values) { foreach ($values as $i => $value) { $field_data[$i][$key] = $value; } } $newfield_data = array(); foreach($field_data as $field) { if(strpos($field['name'], "dontask_") !== false) { continue; } $newfield_data[] = $field; } $this->setModuleFields($fields, $newfield_data, $vars); } } return $fields; } 2. Add "_dontask" in any part of the service field name
3. Protip: you should combine this patch with Universal Module Workaround: Show Service Fields At Client Panel , for best experience.
Preview (Using both patches):
Setting up Universal Module for showing certain service fields in Client's Manage Service (Workaround 1) and Hiding some service fields from being asked at order page
Order Page with hidden fields
Admin CP: Manually activating service, all fields being shown
Fields Shown to Client (Workaround 1 + 2)
Download universal_module.php with both workarounds applied (Only for Blesta 3.2.1): universal_module.php
-
Rodrigo got a reaction from PauloV in [Blesta 3.2.1-3.5.1] Universal Module Workaround 2: Hide Certain Service Fields From Being Shown On Order Page
This patch should help to use the Universal Module for manually provisioning services that need administrators to fill service fields with data after they do the activation. e.g. dedicated servers, IP needs to be shown at control panel after the service is activated, but it shouldn't be asked at order page.
Requirements.
- Blesta 3.2.1
Update: I Upgraded to Blesta 3.5.1 and It worked fine
Instructions:
1. Open components/modules/universal_module/universal_module.php
Find:
public function getClientAddFields($package, $vars=null) { // Same as admin return $this->getAdminAddFields($package, $vars); } Replace with:
public function getClientAddFields($package, $vars=null) { $fields = new ModuleFields(); if (!isset($vars->meta)) $vars->meta = array(); if (isset($package->module_row) && $package->module_row > 0) { $row = $this->getModuleRow($package->module_row); // Set the module row, which will allow us to reference it later when getName() is invoked $this->setModuleRow($row); $row_fields = array(); if ($row->meta) { $row_fields = $this->formatModuleRowFields($row->meta); $field_data = array(); // Reformat package fields into a more usable format foreach ($row_fields['service_fields'] as $key => $values) { foreach ($values as $i => $value) { $field_data[$i][$key] = $value; } } $newfield_data = array(); foreach($field_data as $field) { if(strpos($field['name'], "dontask_") !== false) { continue; } $newfield_data[] = $field; } $this->setModuleFields($fields, $newfield_data, $vars); } } return $fields; } 2. Add "_dontask" in any part of the service field name
3. Protip: you should combine this patch with Universal Module Workaround: Show Service Fields At Client Panel , for best experience.
Preview (Using both patches):
Setting up Universal Module for showing certain service fields in Client's Manage Service (Workaround 1) and Hiding some service fields from being asked at order page
Order Page with hidden fields
Admin CP: Manually activating service, all fields being shown
Fields Shown to Client (Workaround 1 + 2)
Download universal_module.php with both workarounds applied (Only for Blesta 3.2.1): universal_module.php
-
Rodrigo got a reaction from PauloV in [Blesta 3.2.1-3.5.1] Universal Module Workaround: Show Service Fields At Client Panel
Hello,
As other users reported in the forum, this issue is making troubles for services that doesn't have proper provisioning modules.
By doing the following changes, a Tab will appear at client's manage service page, showing all the service fields that have the public_ tag on their name.
Instructions:
1. Open components/modules/universal_module/universal_module.php
Find:
private function isUrl($str) { return preg_match("#^\S+://\S+\.\S+.+$#", $str); } Add After:
/** * Returns all tabs to display to a client when managing a service whose * package uses this module * * @param stdClass $package A stdClass object representing the selected package * @return array An array of tabs in the format of method => title. Example: array('methodName' => "Title", 'methodName2' => "Title2") */ public function getClientTabs($package) { return array( 'moreinfo' => array('name' => "More Info", 'icon' => "fa fa-gears") ); } /** * The More Info tab * * @param stdClass $package A stdClass object representing the current package * @param stdClass $service A stdClass object representing the current service * @param array $get Any GET parameters * @param array $post Any POST parameters * @param array $files Any FILES parameters * @return string The string representing the contents of this tab */ public function moreinfo($package, $service, array $get=null, array $post=null, array $files=null) { $row = $this->getModuleRow($package->module_row); $out = ''; $servicefields = array(); foreach ($row->meta as $key=>$value ) { if (strpos($key, "service_field_name") !== false) { // Here we match the service field label with their key and value foreach($service->fields as $field) { if($field->key == $value) { $name = 'service_field_label_' . str_replace('service_field_name_', '', $key); $servicefields[] = array("label" => $row->meta->$name, "key" => $value, "value" => $field->value); } } } } foreach($servicefields as $field) { // Filter out for showing only public fields if(strpos($field['key'], "public_") === 0 ) { $out .= "<p><b>". $field['label'] . ":</b> " . $field['value'] . "</p>"; } } return "<h4>Service Information</h4><br />" . $out ; } 2. Make sure that the service fields that you want to show to the client start with "public_" prefix
Preview
Setting up public service fields
Service fields being shown on client's "Manage Service" page
Download drop-in replacement file (if you don't want to manually add the above lines) (Only for Blesta 3.2.1): universal_module.php
Caution:
This file will be overwritten if you update Blesta and the Tab will disappear (there is no other risk or any service data loss). If you change the service field name of a existing field, the data will not be preserved (bug?)
EDIT: This still works for Blesta 3.5.1. I'm not sure if it's still needed, but I'm already using it for my production blesta website so there's no way back
-
Rodrigo got a reaction from Michael in Package Custom Fields
Hello,
I've made a patch for Blesta 3.2.1 for showing many service fields into clients panel, and you can choose which ones to show by adding "public_" prefix
Check it out:
[blesta 3.2.1] Universal Module Workaround: Show Service Fields At Client Panel
-
Rodrigo got a reaction from Michael in [Blesta 3.2.1] Order Pages Spanish Language Pack [100%]
Hi,
As the current blesta spanish language pack doesn't include the order page translations (I don't know if it's a bug or the translation is just incomplete), I made a word by word translation for all the included order pages in blesta
Requirements:
-Blesta Spanish Translate Pack Installed (es_es)
Translated Order Pages:
AJAX Wizard Standard
How to Install: Uncompress the archive on blesta root folder
Download: orderpages_spanish_langpack.tar.gz
Feel free to include this language pack onto existing blesta package or translation status. Maybe I'll release more goodies as I prepare my blesta install for production environment
-
Rodrigo reacted to Blesta Addons in Global E-Mail Html Container
i have got your idea. is very good feature request .
i think at least header and footer email template should be unique and modifiable outside the email template .
the idea , if we made for exemple email/phones in the header , we need to change it in all email templates , with Rodrigo idea , we will change it one time .
is like blesta theme . we have header/footer , the content is for the content .
V2.5 was something from this concept .
+++1
-
Rodrigo reacted to flangefrog in Forcing Https Results In Redirect Loop
Have you made sure you have cleared the cache on Chrome? It is very unlikely to be an issue on the server if it works on one browser and not the other.
Edit: maybe you were right, there is a SPDY specific issue related to this https://code.google.com/p/mod-spdy/issues/detail?id=34
-
Rodrigo got a reaction from interfasys in [Blesta 3.2-3.5.1] How To Make Static Pages By Modifying Portal Plugin
Hi,
I'm sharing a quick method for making custom static pages in blest system without any additional plugin. Please consider that any future update would require to take care of the changes made as they can be erased.
In this example I'll be doing a static page that will be located in your_blesta_location.com/services
1.1 Creating a static page with custom HTML
1. Open plugins/cms/controller/main.php
Find:
else { $this->redirect($this->base_uri); } Replace for:
else { switch($uri) { case 'services': $this->structure->set("page_title", "*** INSERT PAGE TITLE ***"); $this->structure->set("title", "*** INSERT TITLE SHOWN ON PORTAL TEMPLATE ***"); // Placeholders won't work with this method, so let's use variables $url = rtrim($this->base_url, "/"); $blesta_url = $this->Html->safe($url . WEBDIR); $html = <<<EOT <div class="col-md-4 col-sm-6 portal-box"> <a href="{$blesta_url}services> <div class="well"> <i class="fa fa-cogs fa-4x"></i> <h4>Foo</h4> <p>Bar.</p> </div> </a> </div> EOT; $this->set("content", $html); break; default: $this->redirect($this->base_uri); } } You can repeat the php case for making all the static pages you want, putting HTML between the EOT marks (There should be no space or characters after EOT; mark). If you don't like the broken indentation you can try another methods for doing multi line strings in PHP, but I think using nowdoc is more easy when you need to insert html.
1.2 Adding custom meta tags to the new static page (optional)
1. Open plugins/cms/controller/main.php
Find
$this->set("content", $html); Add Before:
$metatags = <<<EOT <meta property="og:title" content="foo"/> <meta property="og:description" content="bar."/> <meta property="og:image" content="baz"/> <meta property="og:url" content="http://www.example.com/services"/> EOT; $this->structure->set("metatags" , $metatags); 2. Open /app/views/client/bootstrap/structure.pdt (or in your own template)
Find
<meta name="viewport" content="width=device-width, initial-scale=1.0"> Add after
<?php echo $this->Html->ifSet($metatags) ?> Dev note: this could be easier if could find a way to get structure protected property values, then concat the metatags to an existing variable like $custom_head (Is there a method like $this->structure->get()?)
Also, don't forget that the Portal plugin is being developed for being a fully functional CMS system, so this would not be needed in the future.
Here is my result, I'm linking this custom static page from the blesta portal main page for linking to different order pages (currently in design and module coding process, blesta flexibility is awesome)
Result:
Setting what Facebook shows by modifying meta tags
I hope somebody finds this useful
Bye
EDIT: fixed a detail in $url definition
EDIT2: Added how to add custom html into <head>
EDIT3. Confirming that this still works for Blesta 3.5.1
-
Rodrigo got a reaction from Paul in [Blesta 3.2-3.5.1] How To Make Static Pages By Modifying Portal Plugin
Hi,
I'm sharing a quick method for making custom static pages in blest system without any additional plugin. Please consider that any future update would require to take care of the changes made as they can be erased.
In this example I'll be doing a static page that will be located in your_blesta_location.com/services
1.1 Creating a static page with custom HTML
1. Open plugins/cms/controller/main.php
Find:
else { $this->redirect($this->base_uri); } Replace for:
else { switch($uri) { case 'services': $this->structure->set("page_title", "*** INSERT PAGE TITLE ***"); $this->structure->set("title", "*** INSERT TITLE SHOWN ON PORTAL TEMPLATE ***"); // Placeholders won't work with this method, so let's use variables $url = rtrim($this->base_url, "/"); $blesta_url = $this->Html->safe($url . WEBDIR); $html = <<<EOT <div class="col-md-4 col-sm-6 portal-box"> <a href="{$blesta_url}services> <div class="well"> <i class="fa fa-cogs fa-4x"></i> <h4>Foo</h4> <p>Bar.</p> </div> </a> </div> EOT; $this->set("content", $html); break; default: $this->redirect($this->base_uri); } } You can repeat the php case for making all the static pages you want, putting HTML between the EOT marks (There should be no space or characters after EOT; mark). If you don't like the broken indentation you can try another methods for doing multi line strings in PHP, but I think using nowdoc is more easy when you need to insert html.
1.2 Adding custom meta tags to the new static page (optional)
1. Open plugins/cms/controller/main.php
Find
$this->set("content", $html); Add Before:
$metatags = <<<EOT <meta property="og:title" content="foo"/> <meta property="og:description" content="bar."/> <meta property="og:image" content="baz"/> <meta property="og:url" content="http://www.example.com/services"/> EOT; $this->structure->set("metatags" , $metatags); 2. Open /app/views/client/bootstrap/structure.pdt (or in your own template)
Find
<meta name="viewport" content="width=device-width, initial-scale=1.0"> Add after
<?php echo $this->Html->ifSet($metatags) ?> Dev note: this could be easier if could find a way to get structure protected property values, then concat the metatags to an existing variable like $custom_head (Is there a method like $this->structure->get()?)
Also, don't forget that the Portal plugin is being developed for being a fully functional CMS system, so this would not be needed in the future.
Here is my result, I'm linking this custom static page from the blesta portal main page for linking to different order pages (currently in design and module coding process, blesta flexibility is awesome)
Result:
Setting what Facebook shows by modifying meta tags
I hope somebody finds this useful
Bye
EDIT: fixed a detail in $url definition
EDIT2: Added how to add custom html into <head>
EDIT3. Confirming that this still works for Blesta 3.5.1