Theme Oddity

jlrobinson2171
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?
StephenW

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.

 

Image removed.

 

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.

Image removed.

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.

Image removed.

 

This takes you to the Lessons page. click on "Add new lesson" link near the top of the screen, as shown here.

Image removed.

 

Please let us know if this helps you, or not.

Best Wishes,

Stephen

 

 

 

 

jlrobinson2171

Stephen,

Stephen, The theme I am using is Deco and everything is peachy keen for the most part but if you look at the following screenshot http://thirdphasecomputing.com/screenshots/deco-lessons.png You will see I do not have a link to add new lessons. However, if I switch to the Bartik theme (comes with Opigno) the link is there as you can see in the following screenshot http://thirdphasecomputing.com/screenshots/bartik-lessons.png I have not made any alterations to any theme so I am wondering why the link isn't showing up in Deco but it is for Bartik. Doesn't make a lot of sense to me.
Profile picture for user James Aparicio
James Aparicio

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

jlrobinson2171

You are a life saver James,

You are a life saver James, thanks. Got another theme question. In the Opigno theme when you click on a course it renders a nice little block that looks like this http://thirdphasecomputing.com/screenshots/opigno-course.png On my theme it looks like this: http://thirdphasecomputing.com/screenshots/deco-course.png Where do I find the styling for that? More importantly, how do I get it to say No instead of 0?
Profile picture for user James Aparicio
James Aparicio

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

StephenW

deleted

My comments weren't helpful so I deleted them.

 

jlrobinson2171

I figured out how to get the

I figured out how to get the links to show up but there are other issues I am running into now. Mostly it is just CSS differences between Platon and Deco but there seems to be some rendering differences as well. It seems like some DIVs aren't being picked up by Deco. For example, in Platon there is this DIV when I view the sourcediv 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"
Group: You are the group manager Hide for anonymous users: No Requires validation: No Group visibility: Semi-public (registered users can subscribe to the course)
And then the tools are displayed. But in Deco it puts puts it like this
Group: You are the group manager Course tools: Lessons Lessons allow teachers to assess students and provide slideshows with course content and/or questions. Forum Forums allow teachers and students to communicate. Hide for anonymous users: 0 Requires validation: 0 Group visibility: Semi-public (registered users can subscribe to the course) Hide from Catalogue: 1 Group roles and permissions: Override default roles and permissions
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.
Profile picture for user James Aparicio
James Aparicio

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 

jlrobinson2171

I think I found it in

I think I found it in template.phpfunction 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?
Profile picture for user James Aparicio
James Aparicio

Hi jlrobinson,

Hi jlrobinson,

 

These are hooks, hook_preprocess_node.

The hook must be the name of your theme in this case.

Best regards

 

jlrobinson2171

I tried renaming platon to

I tried renaming platon to deco and it still didn't work.
Profile picture for user James Aparicio
James Aparicio

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