We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

[Answered by community member] my form shows heading & title only . | Forum

suchita jain
suchita jain May 15 '15
i have already made index.html page inside views/controllers folder & a reg/index action inside controllers folder. i am creating a plugin similar to contactus plugin.what should i do now? is it related with admin/dev-tools/lanuages where i have to add fields ? if yes then how can i add them after add clicking add button .for ex
i am having these field names Name,Address, Phone

The Forum post is edited by Alia May 20 '15
ross Team
ross May 15 '15
Topic was moved from Bug reports and troubleshooting.
Alia Team
Alia May 15 '15
I am puzzled on what exactly you need help with.

Please check : https://docs.oxwall.org/dev:crash-course
Could you please specify the stage where you faced the issues at?
suchita jain
suchita jain May 17 '15
hello aliia,

please find the attached file it contains  whole code . i read & follow the course but the link you specified is showing 522 error .its a host error so that i cannot open crash course now.
Attachments:
  registerform.zip (3Kb)
dave Leader
dave May 17 '15
That is the correct link but it is down right now sorry. 


There are 5 basic steps to making a page. 
assuming you are not going to use any db functions. 
create a file in controllers folder with the proper class code  ie  myfile.php

create a file in the views/controller folder  ie     myfile_index.html

create you route call in the init.php file ie 

OW::getRouter()->addRoute(new OW_Route('pluginname.index', 'myfile', 'PLUGINNAME_CTRL_Myfile', 'index'));


Add your code

Add your language keys 


Asssuming everything is correct your page will load.   To test go into your html page and type the word hello at the very top then save and refresh your cache.  Then when your page loads you will see hello on the page and you will know its your page. 

The Forum post is edited by dave May 17 '15
suchita jain
suchita jain May 17 '15
Hello dave,
I have already done these steps .after creating reg_index.html it should be displayed on screen but it's not visible. Please check the attachment & specify where I have
 done mistakes?
The Forum post is edited by suchita jain May 17 '15
dave Leader
dave May 17 '15
i am not sure i would call it registerform, seems such a common name it could conflict.  but outside of that the only thing i see is that whenever you set a controller CTRL the first letter of the file is always uppercase...   so in your php file and in your init file changeit to Reg


class REGISTERFORM_CTRL_Reg extends OW_ActionController { 

"REGISTERFORM_CTRL_Reg", 'index'));?>


let me know if that works i didnt test it 

suchita jain
suchita jain May 17 '15
hello dave,
it's same as previous .changing reg to Reg isn't work.
The Forum post is edited by suchita jain May 17 '15
suchita jain
suchita jain May 17 '15
hello,
please tell me if anyone having offline document of crash course then please give it to me on forum or in my mail id jainsuchita93@gmail.com
The Forum post is edited by suchita jain May 17 '15
dave Leader
dave May 17 '15
i uploaded your plugin and fixed it for you.  


first thing, you never have to use a close php ?> as long as php is the only thing in the file, as a matter of fact it will give you an error or warning or do nothing at all if you do.  So remove all your close php tags from all your files. 


2.always run debug mode when your doing a plugin, if you had it would have told you the problem. 


3.  Always init your vars before you use them, always, it will never pass inspection if you dont, moderation will not accept notices when he moderates a plugin. 


if(!isset($id))    {    $id = ''; }
if(!isset($value)) { $value = ''; }

4. you changed your reg to Reg so that was this one.
5. and then that is not the way you do a selectBox i got warnings on your select box and so i commented it out and the form works.    


The Forum post is edited by dave May 17 '15
dave Leader
dave May 17 '15
to do a select box, before your new form statement set the array either by query or hard code it like so. 


  $ratingopts = array( 

OW::getLanguage()->text('name','admin_rating_option_verybad_text'),

OW::getLanguage()->text('name', 'admin_rating_option_bad_text'),

OW::getLanguage()->text('name', 'admin_rating_option_poor_text'),

OW::getLanguage()->text('name', 'admin_rating_option_fair_text'),

OW::getLanguage()->text('name', 'admin_rating_option_good_text'),

OW::getLanguage()->text('name', 'admin_rating_option_great_text'),

OW::getLanguage()->text('name', 'admin_rating_option_excellent_text'), 

 );


and then in your element do this AFTER THE ELEMENT 


       foreach($ratingopts as $opt => $value)          

      {                       

      $ratingButton->addOption($opt, $value);             

       }//close foreach



hope that helps 


now your form will work 





The Forum post is edited by dave May 17 '15
dave Leader
dave May 17 '15
now remember that the first element in that array is set there as a dummy, it will be assigned via the form but not by the db as it is null value.  so it starts as null,0,1........  so the very bad is there just as a fill in for the array so we can use the other values. 
dave Leader
dave May 17 '15
i also advise that you download and install this plugin  http://www.oxwall.org/store/item/695


it is alot like the crash course in alot of ways but it is a plugin style way of learning.  It is designed to help you learn.

suchita jain
suchita jain May 17 '15
hello dave,
thanks for guide me.
suchita jain
suchita jain May 18 '15
hello,
now i am adding database then its give me pdo exeption. such that

OW Debug - Warning Message: Error while sending QUERY packet. PID=269648 File: /home/freephps/public_html/oxwall/ow_core/database.php Line: 707

OW Debug - Exception

Message: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away File: /home/freephps/public_html/oxwall/ow_core/database.php Line: 707 Trace: #0 /home/freephps/public_html/oxwall/ow_core/database.php(707): PDOStatement->execute() #1 /home/freephps/public_html/oxwall/ow_core/database.php(460): OW_Database->execute('INSERT INTO `ow...', Array) #2 /home/freephps/public_html/oxwall/ow_core/database.php(496): OW_Database->insert('INSERT INTO `ow...', Array) #3 /home/freephps/public_html/oxwall/ow_core/base_dao.php(216): OW_Database->insertObject('ow_base_theme_c...', Object(BOL_ThemeControl)) #4 /home/freephps/public_html/oxwall/ow_system_plugins/base/bol/theme_service.php(388): OW_BaseDao->save(Object(BOL_ThemeControl)) #5 /home/freephps/public_html/oxwall/ow_system_plugins/base/bol/theme_service.php(309): BOL_ThemeService->processTheme(955) #6 /home/freephps/public_html/oxwall/ow_core/application.php(777): BOL_ThemeService->processAllThemes() #7 /home/freephps/public_html/oxwall/ow_core/application.php(744): OW_Application->updateCachedEntities(true) #8 /home/freephps/public_html/oxwall/ow_core/application.php(158): OW_Application->devActions() #9 /home/freephps/public_html/oxwall/index.php(51): OW_Application->init() #10 {main} Type: PDOException 






Attachments:
  exeption.JPG (92Kb)
  reset.JPG (148Kb)
dave Leader
dave May 18 '15
you should have a service.php and then for every db table (that you create) you should have a  name.php and a name_dao.php file 
The Forum post is edited by dave May 18 '15
Alia Team
Alia May 18 '15
Great job Dave. Your are the Man of patience =)

Thank you for helping out our community. Greatly appreciated.