Home » Topics » Pods 1.x » team section
team section
This topic contains 3 replies, has 2 voices, and was last updated by Fike 2 years, 10 months ago.
-
AuthorPosts
-
July 3, 2010 at 6:02 pm #163571
hi
i want to build a team section for a website. there are depatments dividing the team. by default the first department should be shown. at the top there will be a tabbed navigation for selecting the department.
what i’ve done so far: set up a pod called "team", added a pick column for taxonomies to select the department.
how can i create a navigation for this?
thanks
lukas
July 4, 2010 at 1:52 pm #163572You can do a pod page template that will show each department (depending on the current received slug). If this option is applicable (it requires page reloading, but anyway i don’t know javascript), it would be something like this:
123456789101112131415161718192021222324252627<?php$slug = pods_url_variable(-1); //this is used to define which page we are on. $slug will also help to initialize main pod with all data.//let your second pod (the one that contains department names) be called "deps".$deps = new Pod ('deps', 'name ASC');$deps->findRecords('name DESC',-1);$menu='<span class="depsmenu">'; // it is possible to return data with simple "echo" every time we retrieve it, but i like it more this waywhile ( $deps->fetchRecord() ){$deps_name = $deps->get_field('name'); // if you'll use that idea, you'll have two initialized pods, what means that it is better to keep clear, what pod stands after the $name$deps_slug = $deps->get_field('slug'); // you'll need slug column if you'll go this way, but it can be created automatically afaikif ( $slug == $deps_slug ) // i always mess with ifs, so u'm using heavy constructions that works. the whole purpose of it is to make current page tab different from another page tabs with CSS{$div='<span class="depsmenucurrentpage">'.$deps_name.'</span>';}else{$div='<span class="depsmenupage">'.$deps_name.'</span>';}$menu=$menu.$div;}$menu=$menu.'</span>';echo $menu;?>Your output will be a string like
1<span class="depsmenu"><span class="depsmenupage">Dept. 1</span><span class="depsmenupage">Dept. 2</span><span class="depsmenucurrentpage">Dept. 3</span></span>so you’ll be able to control it over CSS. If you’ll put this on some page, other from deps pages, all menu tabs should just be one inactive style, i guess.
July 5, 2010 at 8:15 pm #163573hi fike
thanks! this looks good, gonna give it a try.
isn’t there a nicer way to render pods links? i am thinking of somethin like wp_list_pods().
regards
lukas
July 6, 2010 at 1:19 am #163574There is not such function yet afaik (this template will work on pages with any slug – for the function there is unlimited amount of pages, and we are not checking availible pages – we are building menu for pages that contain data). I think that you can render it as theme function – but i am not sure how Pod should be initalized then (i’m afraid of double initialization on the page and don’t know what will happen), someone more experienced should tell that.
Two more things i need to say: first, i lost the link itself in the code:
1234$deps_name = $deps->get_field('name');$deps_slug = $deps->get_field('slug');$deps_name = '<a href="http:// <a href="http://www.mysite.com/teampage/" rel="nofollow">http://www.mysite.com/teampage/</a>'.$deps_slug.'">'.$deps_name.'</a>'the code tag is not working with a href tag properly, so there shouldn’t be any spans and a class
The second one is about navigation – i actually do now how you can use javascript for only one page. You can render all data in divs with default CSS style as "display:none" and than change it to "display:block", using onClick – this is sure possible and won’t take tens of code lines. The all above code won’t be useful in that way, but there wouldn’t be more complicated construction, i think.
-
AuthorPosts
You must be logged in to reply to this topic.