Details on how add Slider on to your front page on page-front.tpl.php

mojipittan - March 22, 2009 - 16:13
Project:Slider
Version:6.x-1.4
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi Mark,

First, thanks for the awesome work bringing Slider to Drupal! I looked around on the Issue sections for people with similar questions but I have a feeling maybe everyone already knows the answer. If apologise if I am asking in the wrong place.

I am have successfully created a slider as detailed but not sure how I can theme it in order for the slider appear on the front page. I have tried to use Views to create a single block that returns the slider but found it only returned the node referenced nodes rather than the slider.

I am using Zen themes and looking to basically create front page from "block" views and not sure how I can get the slider to appear. Can you point me in the right direction?

#1

Mark Theunissen - March 22, 2009 - 18:16

You can set your site's front page to be the node that you want, at /admin/settings/site-information.

Otherwise, use the PHP function node_view() or use http://drupal.org/project/reptag to add the node into the body of another node.

#2

mojipittan - March 23, 2009 - 03:50

Many thanks, I will give it a bash!

#3

mojipittan - March 23, 2009 - 14:00

I tried looking for more information for the method using PHP function node_view() and the best info I found was http://api.drupal.org/api/function/node_view/6

I tried to add the following code into the area I want it to appear:

<?php
  $node
= 48
function node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE)
?>

48 being the node id for the slider that I have created (www.example.com/node/48/). But doesn't bring the node into the page. Is this the normal way to reference a node?

#4

Mark Theunissen - March 23, 2009 - 14:50

Nope, that's wrong in many ways. Try this:

<?php print node_view(node_load(48), FALSE, FALSE, FALSE); ?>

#5

mojipittan - March 23, 2009 - 15:15

thanks for the suggestion, this brings the individual slides one after rather than have the slider houses the slides. This is also the problem I had when I tried to use View to pull the slider out into a block. will I have to include some code to reference the slider module?

#6

Mark Theunissen - March 23, 2009 - 15:41

If that doesn't work, just set the site's front page to be the Slider node. Add your other customisations in manually, instead of adding the slider in manually...

#7

mojipittan - March 23, 2009 - 16:17

because the node will be generated as a using node-slider.tpl.php I can edit and control that, but then I will have to find a way to customise the page.tpl.php that will end up being called when it is displayed.....

I'm not sure how to proceed in this case, am I going about this the wrong way?

Also, is it possible to put the slider into a block using Views without returning the individual slides?

#8

Mark Theunissen - March 23, 2009 - 17:50

You can override a page template for an individual node with a template for just that node. I think the syntax is page-node-xx.tpl.php

Not sure about the view block, just try it.

#9

mojipittan - March 24, 2009 - 17:10

Thanks for the help. I think I'll put this on hold for now. I am kind of curious though how other people have implemented the slider to their site other than on a frontpage that is.

#10

Mark Theunissen - March 24, 2009 - 17:53
Status:active» closed

Ok I'll close it, reopen when you need to.

 
 

Drupal is a registered trademark of Dries Buytaert.