Joomla.it Forum

Non solo Joomla... => Sviluppo => : xes 08 Apr 2010, 13:04:23

: [RISOLTO]tag title nel body
: xes 08 Apr 2010, 13:04:23
qualcuno sa come posso inserire il contenuto del tag <title> che si trova nell'head anche nel body???

esempio:

:
<head>
<title>TITOLO</title>
</head>
<body>
TITOLO
</body>

Grazie
: Re:tag title nel body
: mikelee 08 Apr 2010, 13:16:23
La domanda non è molto chiara. Cosa vuoi fare precisamente?
Perchè così come la poni basta aprire index.php del tuo template e creare nel tag body un:

<p> TITOLO CHE VUOI </p>
: Re:tag title nel body
: xes 08 Apr 2010, 13:20:24
mi spiace di non essere stato molto chiaro... l'idea è quella ma vorrei che il titolo della pagina fosse generato in automatico...

invece di <p>titolo</p>

<p><includi titolo automaticamente></p>
: Re:tag title nel body
: mikelee 08 Apr 2010, 13:22:33
Ahimè continuo a non capire! Che significa "generato in automatico". Che se cambi il nome del sito deve cambiare anche ciò che è scritto nel body?
: Re:tag title nel body
: xes 08 Apr 2010, 15:12:11
praticamente di solito il tag title contiene "Nome sito - Nome Pagina" vorrei che apparisse anche nel body la scritta "nome sito - nome pagina"

non riesco a spiegarmi meglio oggi....  :(
: Re:tag title nel body
: mikelee 08 Apr 2010, 15:17:26
Prova a scrivere in body questo e poi dimmi cosa succede (non garantisco che funzioni...):

<a href="index.php" title="<?php echo $mainframe->getCfg('sitename');?>"><?php echo $mainframe->getCfg('sitename');?>[/url]
: Re:tag title nel body
: mikelee 08 Apr 2010, 15:19:30
Magari meglio questa:

:
<h1><a href="index.php" title="<?php echo $mainframe->getCfg('sitename');?>"><?php echo $mainframe->getCfg('sitename');?></a></h1>
: Re:tag title nel body
: xes 08 Apr 2010, 15:54:14
ci siamo quasi...questa funzione mi porta solo il nome del sito e non il nome della pagina...conosci una funzione apposita?

grazie mille per la pazienza
: Re:tag title nel body
: mikelee 08 Apr 2010, 17:37:49
Sul nome della pagina mi cogli impreparato...provo a vedere un pò!
: Re:tag title nel body
: xes 08 Apr 2010, 19:46:06
ho fatto una manovra che non so quanto sia corretta ma per ora risolve allego tutti i passaggi

nella cartella

:
/propriosito.xxx/libraries/joomla/document/html/renderer/
ci sono i file richiamabili da jdoc

ho così creato un mio file title.php partendo dall'esempio di head.php

vi allego il risultato

:
<?php
/**
* @version $Id: title.php 11917 2009-05-29 19:37:05Z ian $
* @package Joomla.Framework
* @subpackage Document
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();

/**
 * JDocument page title render
 *
 */
class JDocumentRendererTitle extends JDocumentRenderer
{
/**
 * Renders the document head and returns the results as a string
 *
 * @access public
 * @param string  $name (unused)
 * @param array  $params Associative array of values
 * @return string The output of the script
 */
function render$title null$params = array(), $content null )
{
ob_start();

echo $this->fetchTitle($this->_doc);

$contents ob_get_contents();
ob_end_clean();

return $contents;
}

/**
 * Generates the head html and return the results as a string
 *
 * @access public
 * @return string
 */
function fetchTitle(&$document)
{
// get line endings
$lnEnd $document->_getLineEnd();
$tab $document->_getTab();

$tagEnd ' />';

$strHtml '';

$strHtml .= $tab.''.htmlspecialchars($document->getTitle()).''.$lnEnd;


return $strHtml;
}
}

così dall'index.php mi basterà richiamare
:
jdoc include type="title"
e il gioco è fatto

spero possa servire a qualcun'altro!
grazie comunque dell'aiuto!!!
: Re:[RISOLTO]tag title nel body
: Lilith 07 May 2010, 22:47:19
A me! Grazie!  :-*