• Welcome to WebsiteBaker Community Forum. Please log in or sign up.
Welcome, Guest
News
Support WebsiteBaker
Your donations will help to:
PayPal
  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!
You can donate by clicking on the button below.

Put news title in template

Started by misterdj, April 04, 2024, 08:16:28 AM  ( Read 25,478 times )

misterdj

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

    hgs

    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?
      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)

      Gast

      try this function instead of your code in the head-area of your template-index.php

      <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

        misterdj

        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


          Gast

          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.


            misterdj

            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

              Gast

                :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

                Gast

                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

                  misterdj



                  \n\n