Pages

Sunday, April 21, 2013

Social Engine 4-Render and manage a page/view from backend

Here I will show you how to create and run a page from backend and get the control of the same from backend in Social Engine 4

Generally when we create pages we need to define a controller and action for them and control them via code.Some themes have fixed pages in them which are controlled directly from backend.

But if we want to add a custom page to be manageable from backend here is how to do the same

  1. First things First Take a backup of your database and also the files that you modify along I prefer to use a versioning system for lator case
  2. Create a new blank page from "Layout Manager"  in the backend/backadmin of Social Engine 4
  3.  Now go to your database and in the table Engine4_core_pages you will find NULL in "name" change this to "yourmodulename_yourcontrollername_yourviewname" for example if your
    1. Module is "Credits"
    2. Controller is "index"
    3. View is also "index"
Then name will be "credit_index_index"

Give it a title and description which you can also set from backend by modifying this page

4. Navigate to your Module directory "credits" in this case and then navigate to controllers and under controller create a file "IndexController"

1:  <?php   
2:  class Credit_IndexController extends Core_Controller_Action_Standard  
3:  {  
4:    public function indexAction()  
5:    {  
6:        $this->_helper->content->setNoRender()->setEnabled();  
7:    }  
8:  }  
9:  ?>  

This lets you add page from backend but will not render its content i.e "/module/views/scripts/index.tpl"

Now your view will be rendered and managed from backadmin only

Social Engine 4-Creating a widget in a module

Before creating a widget in a module we need to register the same

1. Go to your module folder and then in your module go to file

settings/content.php

This file contains all widgets which this module will provide.

As an example we will create a widget to show graph and also called it graph

This file returns an array of array's where the former contains various widgets information

 return array(  
  array(  
   'title' => 'Navigation Tabs',  
   'description' => 'Displays the Navigation tabs(menu) for Credits: Credits Home, My Credits, FAQ. Put this widget on the top of Credits Home and My Credits pages.',  
   'category' => 'Credits',  
   'active' => true,  
   'type' => 'widget',  
   'name' => 'credit.navigation-tabs',  
  ),  
  array(  
   'title' => 'Top Members',  
   'description' => 'Displays top members list with highest number of credits. Put this widget on Credits Home or on any other page.',  
   'category' => 'Credits',  
   'active' => true,  
   'type' => 'widget',  
   'name' => 'credit.browse-users',  
   'defaultParams' => array(  
    'title' => 'Top Members'  
   )  
  ),  
  array(  
   'title' => 'Graph',  
   'description' => 'Displays a widgets which displays a list of quick links to create a graph.',  
   'category' => 'Credits',  
   'type' => 'widget',  
   'name' => 'credit.graph',  
    'active' => true,  
   'defaultParams' => array(  
    'title' => 'Graph'  
   )  
  ));  

Look in the last array we have added our custom widget array in the end

Now lets move into the widget's folder of our module

Let's suppose our Module name is "Credit"

so in /widgets/graph/controller.php

We need to create these directories as per requirement

1:  Class Credit_Widget_GraphController extends Engine_Content_Widget_Abstract  
2:  {  
3:     public function indexAction()  
4:     {  
5:        $this->view->myvar="myvarvalue";  
6:       //You can also include forms (defined in forms of your module)  
7:         $this->view->form=new Filter_Form()  
8:     }  
9:  }  

Look at the name of the class see in settings file we have defined property "name" in widget array as credit.graph like wise here "Credit" is our module and "Graph" is widget...This should match with property.

Next we define template in
in /widgets/graph/index.tpl

and Access variables as

1:  <?php echo $this->filterForm ?>  


That's It Add widget from backend to the respective page

Social Engine 4-Flash,External Interface Available Text

Text in Social Engine

SM2 SWF V2.97a. 20110918(AS3/Flash)
External Interface Available
Adding External Interface Callbacks
Testing Flash->JS,
JS->Flash OK
Flash->JS OK

This is Social Engine Debug Info and comes only in Production Mode

Stop a link from reloading page

Place Javascript:void(0) for the href property.

or Javascript:return 0 and your page will not reload it self on click of the link.

Wednesday, April 3, 2013

Magento install error - Exception printing is disabled

Here is the walk through to recover from this error

  1. Navigate to the "errors" folder.
  2. Change local.xml.sample to local.xml
Worked for me till here while I was in installation phase

However fellow experts have added few more steps

3. You will see a bunch of errors now
4. Open magento/lib/Zend/Cache/Backend/File.php and look for:

protected $_options = array(
'cache_dir' => 'null', 


5. Change the same to

protected $_options = array(
'cache_dir' => 'tmp/', 


and save the file

6. Now the final step is to go create a tmp folder in the root Magento folder.


That's It

Tuesday, April 2, 2013

Magento-Home Page-Store or Store View is not showing up-404 error: Page not found

Checklist :

1. Make sure the default store view of your defaut store of your default website is not disabled.
2. Flush your cache's
3. Reindex Data
4. Set Main website as default and and then set back your website as default.

The last option worked me with once I changed the Default store for my default website and did every thing till 7th point untill I hit and tried 8th one and it worked for me.

If this is not helping you need to debug the issue since it may either be your .htaccess issue or issue from index.php
Open the index.php in root directory of the Magento installation and comment the line
Mage::run($mageRunCode, $mageRunType);
 (you will find this line near the end)
 Run your website if you still find a 404 page not found error its an .htaccess issue try renaming the same

Else try this hardcode in index.php

Just above the code mentioned above type in the following code

/* Store or website code */
$mageRunCode = 'code of store view to load';

/* you will find the code field when you edit your store view type the same code exactly here */

/* Run store or run website */
$mageRunType ='store';


(make sure you type this just before the code line "Mage::run($mageRunCode, $mageRunType);" ) inorder to override default value of these variables

If you are able to open your store view here you need to go back and check store Management.

Post here if you further have any issues

Magento-Home Page-Language drop down not showing up

Checklist:

1. To show a language bar in the header of your website you should have multiple stores(or store views).

If I peek into languages.phtml we get the following code

"getStores())>1): ?>"

which clearly states that the number of stores should be greater than 1

2. Make sure in case you are using 2 websites the "Main Website" default one and the other one(your's) then your's should be default one.

3. Make sure System>>Configuration>>General>>Locale is set to local languages for your respective store views.

4. Make sure language files are installed perfectly and correctly.If not download them from

http://www.magentocommerce.com/translations

and added them in accordance to the folder sequence as in zip file

5. Make sure it is called correctly in page.xml in respective block

6. Flush your cache's

7. Reindex Data