WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.13.x) »
  • Modules »
  • Put news title in template
  • Print
Pages: [1]   Go Down

Author Topic: Put news title in template  (Read 13927 times)

Offline misterdj

  • Posts: 17
Put news title in template
« on: April 04, 2024, 08:16:28 AM »
First of all, I hope this is in the right topic, it's a mix of topics.

I use the News module v4.0.3 and it works perfectly, but I would like to use the [TITLE] used in the news module also on the standard/used template of WebsiteBaker. For example, how do I always show the Title of a posted message in NEWS module [TITLE] as the main title of the website, so <title>[TITLE]</title>

<title>[TITLE]</title> does not work, it does not recognize [TITLE].

I hope someone can help me.

Thank you in advance

DJ
Logged

Offline hgs

  • WebsiteBaker Org e.V.
  • **
  • Posts: 1883
    • EFG MG
Re: Put news title in template
« Reply #1 on: April 04, 2024, 10:41:07 AM »
I don't quite understand where this title should appear, the title is displayed in the FrontEnd.
Where do you want it to be displayed?
Logged
LG Harald

"Fange nie an, aufzuhören - höre nie auf, anzufangen." Marcus Tullius Cicero (106-43 v.Chr.)

"Never begin to stop - never stop beginning." Marcus Tullius Cicero (106-43 BC)

Offline sternchen8875

  • Global Moderator
  • *****
  • Posts: 601
Re: Put news title in template
« Reply #2 on: April 04, 2024, 11:03:19 AM »
try this function instead of your code in the head-area of your template-index.php

Code: [Select]
<title><?php page_title(); ?></title>
the placeholder [TITLE] is defined as "intern title" for this section and in use for a lot of modules in the same way. but it works only in some special predefined blocks in module-intern templates, specially the phplib-templates

page_title() is a globale wb-function and display a combination of the page_title, defined in wb-options and the page_title of the actual page in the frontend. it display in the case of the news-module also the title of the news
Logged

Offline misterdj

  • Posts: 17
Re: Put news title in template
« Reply #3 on: April 04, 2024, 11:12:18 AM »
Okay, I understand that it is not possible to show the title from another module, news module in this case, in the main template of Website Baker?

It is indeed the title from the news module
like here in the picture

Logged

Offline sternchen8875

  • Global Moderator
  • *****
  • Posts: 601
Re: Put news title in template
« Reply #4 on: April 04, 2024, 11:20:02 AM »
Quote from: misterdj on April 04, 2024, 11:12:18 AM
Okay, I understand that it is not possible to show the title from another module, news module in this case, in the main template of Website Baker?

read my answer again - IT IS POSSIBLE to show the title from another module, news module in this case, in the main template of Website Baker.

Logged

Offline misterdj

  • Posts: 17
Re: Put news title in template
« Reply #5 on: April 04, 2024, 11:49:33 AM »
Sorry, I don't understand it correctly, my English is not that good. Are there any examples of how I can adjust this or a hint where I can look? Thanks in advance
Logged

Offline sternchen8875

  • Global Moderator
  • *****
  • Posts: 601
Re: Put news title in template
« Reply #6 on: April 04, 2024, 12:43:32 PM »
  :oops: i've to say sorry and go a step back  :oops:

i was very sure, that it works for me in some projects and so i write my answer, but i didn't see, that i use the simplepagehead-Module for that. this is very easy to use and upgrade-safe

another solution needs some changes in the view.php of the used modules and will lost in the next upgrade, so, not the best solution

to simplepagehead
its a old, but very good working module from Chio, a former member here with a lot of good modules and templates. This module replace some informations in the head-area of the page-output. It reads for some special defined modules the detail-informations from the database, in the news-module the title of a news, the short-content, the keywords from the news-overview-page and the description of this page

With these informations, the module replace the globale page description from the wb-options with the page description from the news-overview, also the keywords (if defined) and the title

the simplepagehead-module has pre-defined definitions for news-module, bakery (shop), (image)gallery, gocart (simple shop) and topics. its possible, to add more modules or remove unneeded things like gocart etc



Step 1 - install the module from the attachement
Step 2 - index.php of the used frontend-template

standardcode in the index.php of the template without simplepagehead

Quote
<head>
<meta name="robots" content="index,follow" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php page_title(); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php if(defined('DEFAULT_CHARSET')) { echo DEFAULT_CHARSET; } else { echo 'utf-8'; }?>" />
<meta name="description" content="<?php page_description(); ?>" />
<meta name="keywords" content="<?php page_keywords(); ?>" />

change to

Quote
<head>
<meta name="robots" content="index,follow">
<meta name="viewport" content="width=device-width, initial-scale=1">
 <?php if(function_exists('simplepagehead')) {
        simplepagehead();
} else { ?>
<title><?php page_title(); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php if(defined('DEFAULT_CHARSET')) { echo DEFAULT_CHARSET; } else { echo 'utf-8'; }?>">
<meta name="description" content="<?php page_description(); ?>">
<meta name="keywords" content="<?php page_keywords(); ?>">
<?php
}

Step 3 - check the output in the source-code, especially the head-area. be sure, that you've no double entries

if you need help, ask for it

P.S.: the module works for me in different wb-versions from WB 2.10 up to the latest 2.13.5 R223
Logged

Offline sternchen8875

  • Global Moderator
  • *****
  • Posts: 601
Re: Put news title in template
« Reply #7 on: April 04, 2024, 12:50:41 PM »
Quote from: misterdj on April 04, 2024, 11:49:33 AM
Sorry, I don't understand it correctly, my English is not that good. Are there any examples of how I can adjust this or a hint where I can look? Thanks in advance

no problem - write in your own language, if its better for you  :wink:

there are enough translation-apps, so it doesn't matter
Logged

Offline misterdj

  • Posts: 17
Re: Put news title in template
« Reply #8 on: April 04, 2024, 01:09:11 PM »
Yeah its works!!! Thanks alot

 :-)
Logged

Offline sternchen8875

  • Global Moderator
  • *****
  • Posts: 601
Re: Put news title in template
« Reply #9 on: April 04, 2024, 01:26:17 PM »
 (Y) (Y)
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.13.x) »
  • Modules »
  • Put news title in template
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2