How to define another teaser for the second theme? - drupal-7

I have two themes: regular (1st) & mobile (2nd). Mobile theme binded with subdomain m.mysite.com.
I can't show my mobile node teaser in mobile theme.
I've created that teaser for mobile theme in Display Suite. Next I need to show this one in mobile theme taxonomy tag page. But I can't define theme in DS. When I use [taxonomy-term.tpl] in mobile theme to define mobile teaser, but vars doesn't works: changing $view_mode has no result (type machine name on mobile teaser), $content array is empty.
I tryed to use Views, but in displays there is no options to define a theme.
What can I do?
Thnx

Problem solves by the following:
1. Created DS template for default teaser in 2nd theme: ds-2col--node-article-teaser.tpl.php
2. Place into it code to define my new node_teaser_mobile to show: print render(node_view($node, $view_mode = 'node_teaser_mobile', $langcode = NULL));

Related

Add Usr Custom Field to Acumatica Appointments Mobile App

I'm trying to add a custom field to the mobile application Appointments screen FS300200. It seems simple where I update the containers and add the field but it's not showing up on the screen. For testing purposes, I was able to edit the display name of a field in the same container so my acumatica instance is talking to the mobile app okay. Anyone know what I'm doing wrong? The field name is UsrUnitNbr (display name Unit Nbr. and I confirmed this in web services). I've tried:
add field "UnitNbr"
add field "UsrUnitNbr"
add field "Unit Nbr".
Here is the full command from the mobile app portion of the customization project editor
update screen FS300200 {
update container"AppointmentRecords" {
update layout "AppointmentHeader" {
update layout "AppointmentHeaderNbrRow" {
add field "UnitNbr"{displayName ="Unit Nbr."}
}
}
}
}
First thing....the blue area at the top of the appt mobile screen is the container AppointmentRecords. Notice the layout tag = "HeaderSimple". This means fields inside this container is read only. Try to add your user field here.
update layout "ServiceOrderNbrLine" {
displayName = "ServiceOrderNbrLine"
layout = "Inline"
add field "UsrUnitNbr"
}

hide right sidebar on specific pages in drupal

I want to remove the sidebar from the specific page and all its subsequent pages in Drupal 7
My code is mention below.code is in mytheme_preprocess_node(&$variables) function
if ($variables['type'] === 'project'){
$node = $variables['node'];
if($node->type=='project'){
//print_r($node);
echo $node->type;
unset($page['sidebar_second']);
}
why don't you create a tpl file for that specific content type and remove the sidebar from there ? just an idea
Try restricting the block in Blocks UI or with the Context module.
You can restrict that sidebar content in admin panel itself. login as admin and configure that sidebar block to display only on perticular url.

Drupal <front> tag not working on menu link

I'm new to Drupal CMS. Here I want to set front page link for main menu item. It set that for front page link as per Drupal guide. But, it gives an unexpected result example.com/.
Is there any way to display any front page or blank for my main menu item eg: example.com?
Note that I'm using a custom theme.
By default Drupal doesn't add slash if tag is used. You can try checking your rewrite rules.

Completely change the design of a page in Drupal 7

Is there a way I can fully customize a page in Drupal? I don't want the Drupal header or any other HTML generated by Drupal to show up, but I want to be able to access the Drupal functions.
Basically you want a new page template (as opposed to a node template). This does not quite work out of the box in Drupal 7 so there are a few steps:
Step 1
Create a new content type for this specially themed page, call it "special" or whatever...
Step 2
Add this code to your theem's template.php file. (Replace "yourthemename" in the code below with your theme's machine name, that is to say the name of your theme folder in /sites/all/)
function yourthemename_preprocess_page(&$vars) {
if (isset($vars['node']->type)) {
$vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
}
}
Step 3
Create a new page template in your theme folder and name it after the new content type. so for example: page--special.tpl.php and "special" being the name of the content type. Customize away!
Step 4
Clear cache
Step 5
Create a new peice of content using your new content type -- it will be in the design of your new page template.
The end result will be like having a completely separate theme but staying within your existing theme.
Note, I wrote a blog post on how to do this for Drupal 6 but if you read down the comments, there are ideas and links how do this for D7 but basically what I have said here.
http://highrockmedia.com/blog/creating-custom-content-type-page-templates-drupal-php
You can run an alernative page.tpl.php file. Eg. page--front.tpl.php
Not sure it's the best way to do this but it will work. You can strip anything you don't want out of the file so it is totally different to other pages.
Drupal is pretty flexible:
<?php
$json = array(
'body' => 'This is the body of the page.',
'title' => 'This is the page title',
);
return drupal_json_output($json);
?>

How to call CSS for home page in drupal?

A drupal 7 based website has a custom home page. Presently, the whole drupal website has one css called
style.css
. I have written a new css just for home page. Being new to drupal, I have no idea how to specify to home page to use custom css. How to use <link rel....> kind of thing?
Thanks
Not sure why you would want to do this rather than just using different classes but if you really need to you can add a template.php file to your theme. In there use the hook_preprocess_page to add a new stylesheet depending on the homepage. Change YOUR_THEME to your themes name.
function YOUR_THEME_preprocess_page(&$variables) {
$homepage_id = YOUR HOMEPAGE NODE ID;
if (isset($variables['node'])) {
if ($variables['node']->nid == $homepage_id){
drupal_add_css(path_to_theme() . '/css/homepage.css');
}
}
}
I don't think this is the way to go.
If you customised the homepage, you could add a wrapper with a class specific for the homepage.
Then you could target that class with the style.css file and apply specific styles to the homepage.
Sincerely,
dimitril
Most themes have classes built into the body tag to designate "is front". That said, the proper way to do this is to open up template.php in your theme folder and add this code:
function YOURTHEME_preprocess_node(&$variables) {
$node = $variables['node'];
if (drupal_is_front_page()) {
drupal_add_css(drupal_get_path('theme', 'YOURTHEME').'/css/homepage.css', 'theme');
}
}
You'll replace YOURTHEME with your themes name.
Use the CSS tag .front to target only the homepage in Drupal 7. This works fine for me.
This example will target only the side bar second in the home page:
.front .region-sidebar-second{
background-color: #E9EDF2;
}

Resources