Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

ArckNet

[Resolvido] CSS no link do breadcrumb

Recommended Posts

[RESOLVIDO]

Olá Pessoal,

 

Encontrei um script na net para criar o breadcrumb e deu certinho. Mas o link que ele cria na página para voltar não configura de acordo com o CSS q criei. Fica apenas nas cores padrão. A parte que é em texto configura normal, apenas o link que não.

açguém tem uma dica aí?

 

Segue o código:

 

Código da Página - breadcrumb.php

 

<?php

class Breadcrumb{

/*

* Breadcrumb navigation class

* Mick Sear

* http://www.ecreate.co.uk

*

* The key to using this is to decide on a $level for each page. (array, starting position 0)

* This determines where in the trail a link will be placed. So, I normally make the homepage level 0,

* then every page that can be accessed from the top level nav becomes level 1, and every page

* from that second level becomes level 2, and so on. When users return to a higher level (e.g. level 1)

* the surplus links are removed. Only one page can occupy a $level in the crumb trail.

* There might be several routes to a page. In which case, the trail will reflect the route that the

* user actually took to get to that page.

*/

 

var $output;

var $crumbs = array();

var $location;

 

/*

* Constructor

*/

function Breadcrumb(){

 

if (!isset($_SESSION)) session_start();

 

if (isset($_SESSION['breadcrumb']) && $_SESSION['breadcrumb'] != NULL){

$this->crumbs = $_SESSION['breadcrumb'];

}

 

}

 

/*

* Add a crumb to the trail:

* @param $label - The string to display

* @param $url - The url underlying the label

* @param $level - The level of this link.

*

*/

function add($label, $url, $level){

 

$crumb = array();

$crumb['label'] = $label;

$crumb['url'] = $url;

 

if ($crumb['label'] != NULL && $crumb['url'] != NULL && isset($level)){

 

while(count($this->crumbs) > $level){

 

array_pop($this->crumbs); //prune until we reach the $level we've allocated to this page

 

}

 

if (!isset($this->crumbs[0]) && $level > 0){ //If there's no session data yet, assume a homepage link

 

$this->crumbs[0]['url'] = "/index.php";

$this->crumbs[0]['label'] = "Home";

 

}

 

$this->crumbs[$level] = $crumb;

 

}

 

$_SESSION['breadcrumb'] = $this->crumbs; //Persist the data

$this->crumbs[$level]['url'] = NULL; //Ditch the underlying url for the current page.

}

 

/*

* Output a semantic list of links. See above for sample CSS. Modify this to suit your design.

*/

function output(){

 

echo "<div id='breadcrumb'><ul>";

// echo '>';

foreach ($this->crumbs as $crumb){

 

if ($crumb['url'] != NULL){

 

echo "<li> > <a href='".$crumb['url']."' title='".$crumb['label']."'>".$crumb['label']."</a></li> ";

//echo " > <a href='".$crumb['url']."' title='".$crumb['label']."'>".$crumb['label']."</a>";

 

} else {

 

echo " > ".$crumb['label'];

 

}

}

 

//echo "</ul></div>";

}

}

?>

 

Código que fica na página onde o link aparece:

 

<?php

require "breadcrumb.php"; //supondo que voce tenha salvo o codigo em outro arquivo

$trail = new Breadcrumb(); // instancia a classe

$trail->add(HOME , $_SERVER['PHP_SELF'], 0);

?>

<?php

$trail = new Breadcrumb();

$trail->add($row_RsDepartamento['setor_nome'] , $_SERVER['PHP_SELF'], 1);

?>

<?php

$trail = new Breadcrumb();

$trail->add($row_RsDepartamento['dep_nome'] , $_SERVER['PHP_SELF'], 2);

 

echo "

<style>

#breadcrumb ul li{

list-style-image: none;

display:inline;

padding: 0 3px 0 0;

margin: 3px 0 0 0;

font-family:Arial, Helvetica, sans-serif;

color:#FFF;

font-size: 11px;

}

#breadcrumb ul{

margin:0;padding:0;

list-style-type: none;

padding-left: 1em;

}

a.breadcrumb li:link {

font-family:Arial, Helvetica, sans-serif;

color:#FFF;

font-size: 11px;

}

 

</style>

";

 

//Now output the navigation.

$trail->output();

?>

 

Eu consigo mudar a parte de texto, mas o link não consegui.

Valeu... Obrigado!!!

[RESOLVIDO]

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.