Forums
Hoping you can point me in the right direction on this. I am trying to get Opigno to work with a different theme and so far it has worked out fairly well until a few minutes ago.
I created a course and then clicked on Lessons. Once the page finished loading I did not have the link to Add a New Lesson like I should. Is this a simple fix? I'm sure there is probably something missing in one of the template files or something. Any ideas on where I should look?
This example applies to the
This example applies to the NewsFlash Theme.
I also put another theme on Opigno. I used NewsFlash (one of my favorite Drupal Themes).
I don't know exactly which theme you used, or what you may done, or not done. Let me start at kind of a beginning point. You can put your main menu various places, but for this I put my main menu in a menu block on the left side. to check that go to the top menu and choose Struture>blocks. Then make sure the Main menu is configured to be on the left side bar, as shown in the picture.
Secondly, hopefully "My Courses" should be on the left under Main Menu, click on it which takes you to the "My Couses" page. Then, in the right pane, click on name of your course, as shown here.
this will take you to your course page (in this case the name is "Demo couse"). In the left pane, click on "Lessons", as shown here.
This takes you to the Lessons page. click on "Add new lesson" link near the top of the screen, as shown here.
Please let us know if this helps you, or not.
Best Wishes,
Stephen
In reply to This example applies to the by StephenW
Stephen,
Hi jlrobinson
Hi jlrobinson
Those buttons are in the $action_links variable.
If they are not showing, it is because the theme you have chosen does not render them in page.tpl.php.
Just look at the page.tpl.php of bartik for example to check how they are rendered, and add it to the page.tpl.php in the your theme.
Hope this helps you, best regards
James Aparicio
You are a life saver James,
Hi jlrobinson,
Hi jlrobinson,
I guess that is only css. Check the class name of the block and search for it inside the opigno css files.
Displaying the "No" should be in a preprocess function inside template.php
Best regards
deleted
My comments weren't helpful so I deleted them.
In reply to deleted by StephenW
I figured out how to get the
div class="node-course-other-fields node-course-more-info"
But in Deco I cannot find this DIV anywhere when I view the source. Another thing is in Platon all of this is in one "block" And then the tools are displayed. But in Deco it puts puts it like this It is just odd and a pain in the rear to figure out what is going wrong. I may take a look at other themes but I really like Deco.Hi jlrobinson,
Hi jlrobinson,
There is nothing "wrong" with the theme, most probably. As i said, the conversion of the 0 to "No" for example is done at the theme level. In the template.php file in a preprocess function, If you are using another theme, this configuration is not done.
If you create a sub theme, it would be inherited but in this case it is not. What you can do is a recursive search inside the theme folder and search for this class name, that way you know where it is being defined. For example in a specific template file or javacript for example.
Best regards
I think I found it in
function platon_preprocess_node(&$vars) { if (defined('OPIGNO_COURSE_BUNDLE') && !empty($vars['node']->type) && in_array($vars['node']->type, array(OPIGNO_COURSE_BUNDLE, 'class'))) { $vars['content']['fields'] = array( '#weight' => -100, '#prefix' => '', '#suffix' => '', ); $i = 0; foreach ($vars['content'] as $key => $item) { if (!in_array($key, array('body', 'opigno_course_tools')) && !empty($item['#theme']) && $item['#theme'] === 'field') { $vars['content']['fields'][$i][$key] = $item; $i++; unset($vars['content'][$key]); } } $roles = og_get_user_roles('node', $vars['node']->nid); foreach ($roles as $role) { $vars['classes_array'][] = str_replace(' ', '-', $role); } if (user_access('administer nodes')) { $vars['classes_array'][] = 'is-admin'; } } } /** * Implements template_preprocess_field(). */ function platon_preprocess_field(&$vars, $hook) { if (!empty($vars['element']['#field_name'])) { switch ($vars['element']['#field_name']) { case 'course_quota': if ($vars['items'][0]['#markup'] == '-1') { $vars['items'][0]['#markup'] = t("No limit"); } break; case 'group_access': $vars['items'][0]['#markup'] = t($vars['items'][0]['#markup']); break; } } if (!empty($vars['element']['#field_type'])) { if ($vars['element']['#field_type'] == 'list_boolean') { if ($vars['items'][0]['#markup'] == '0') { $vars['items'][0]['#markup'] = t("No"); } elseif ($vars['items'][0]['#markup'] == '1') { $vars['items'][0]['#markup'] = t("Yes"); } } } }
I tried just pasting this into my template.php but that doesn't seem to work. Any ideas?Hi jlrobinson,
Hi jlrobinson,
These are hooks, hook_preprocess_node.
The hook must be the name of your theme in this case.
Best regards
In reply to Hi jlrobinson, by James Aparicio
I tried renaming platon to
If the theme is called deco,
If the theme is called deco, the function name has to be deco_preprocess_node
The cache has be cleared, after you add a new hook for it to be taken into account.
You can enable the devel module and add a line at the beggining of the function and see if it beeing called.
dpm("Some string to be printed in the site");
Best regards