Help With Fields

Help With Fields, a forum discussion on Jojo CMS. Join us for more discussions on Help With Fields on our General Discussion forum.

Back to Forum Index : Back to General Discussion   RSS
JAGGZ

22 Nov 2010
Posts: 3

Hi I have started looking into a Jojo CMS site that requires a couple of additions, I never originally built the site so I am not familiar with Jojo but do have some small development knowledge.

I have a problem with inserting a field into a page that already has existing fields I go to Edit Field Data > New I then add in the field requirements however I cannot enter in the Table or the Field names for which the field related too, I continue to create the new field I get a pop up that tells me the field has been created however I cannot find it.

Is this something that requires SQL access to add the field rows or can fields be added to existing pages. I have been through the documentation but had no luck there.

Thanks in advance appreciate any help or direction
Jaijaz Jaijaz

23 Nov 2010
Posts: 215

Hi and welcome to Jojo.

Yes your guess is correct. You will need to add the field into the SQL database first. From there it is a case off running setup on the site. This will add the field to the field data page. You can then configure as needed.

Jai
If you not living on the edge you taking up too much space.
tom

Developer

tom

23 Nov 2010
Posts: 379

if you don't have access to the database directly you can also add a new field by adding an 'install_tablename.php' file to themes/yourtheme/install/

with something like this in the file
<?php

/* add the new template field if it does not exist */
if (Jojo::tableExists('page') && !Jojo::fieldExists('page', 'pg_template')) {
Jojo::structureQuery("ALTER TABLE `page` ADD `pg_template` ENUM( 'default', 'home' ) NOT NULL default 'default';");
}


and then run setup from
http://yourdomain.com/setup
JAGGZ

25 Nov 2010
Posts: 3

Hi thanks for your input Jaijaz + Tom yes we don't have access to the database, Tom your idea would work perfectly but I just need to double check something

When I go into themes/mytheme, I see the theme and a button that says "reinstall" I am a little reluctant to push the "re-install" button will this wipe the entire site or will it allow me to add new info like a new field?
tom

Developer

tom

25 Nov 2010
Posts: 379

Reinstall won't wipe anything, but I'm not sure if it will do the equivalent of running setup either, it might though..

if you go to
http://yourdomain.com/setup and use the MASTERPASS from config.php
that will check for any install_tablename.php files and alter the database as necessary to match.

You can also add an 'autoupdate_tablename.php file to the same foldder with something like this in it
<?php

$table = 'page';
$field = 'pg_template';
$default_fd[$table][$field]['fd_order'] = 7;
$default_fd[$table][$field]['fd_type'] = 'radio';
$default_fd[$table][$field]['fd_default'] = 'default';
$default_fd[$table][$field]['fd_name'] = 'Page Template';
$default_fd[$table][$field]['fd_help'] = 'Template to assign to this page (to be used in CSS styles)';
$default_fd[$table][$field]['fd_mode'] = 'basic';
$default_fd[$table][$field]['fd_tabname'] = 'Content';

to set the field type and field options at the same time
JAGGZ

26 Nov 2010
Posts: 3

Thanks Tom will give your suggestions a try and see what happens
Back to Forum Index : Back to General Discussion   RSS
You must be logged in to post a reply



You need to Register or Log In before posting on these forums.