How to set titles for the web pages? - joomla

I have 2.5.6, how can I create a new web page with a new title? Now I have a navigation bar and the title of the pages correspond to the text in the items in the navigation bat, how can I create titles that are not the same as the items' content in the navigation bar? For exampe for the item "Home" the title of the page now is also "Home".

If you use the Help button in the toolbar for a menu item you'll find there is a section called "Page Display Options" the first field is called "Browser Page Title"
The "Browser Page Title" is described as optional text for the "Browser page title" element. If left blank, the default value is used based on the Menu Item Title..

From the Forum
You can go to Global Config > Site > SEO Settings there is an
option to include site name in page titles so you would then get
"article title - site name" as your page title.

ccpl's anwser is valid but that would be a static title. If you would like to have a dynamic title where it would change depending where you visit you will have to code it.
For example, if your site is a dictionary where you had the alphabet in the same menu the static title wouldn't ever change even if you chose any of those letters.
To make a dynamic title using code so it would change you should use this:
This is an example of a site that I'm developing where the title changes depending on the name you click on (the site is about terms & definitions).
$doc =& JFactory::getDocument();
$db = JFactory::getDBO();
$select="SELECT name";
$from="FROM #__csglosary_terms ";
$where="WHERE id=".$this->item->id;
$query=$select.$from.$where;
$db->setQuery($query);
$title=$db->loadResult();
$doc->setTitle("Glosary of terms and definitions - Term ".ucfirst($title)." - Dictionary of terms used in hotels, restaurants.");
The variable $title returns the term you have clicked on and will show up on the pages title.
Hopefully this helps you also :).

Related

Is it possible to remove the "new article" button from all sections in a Joomla website?

A mate and I are doing an internship at university, and the project we are working on is a small Joomla 4.1 website. Our supervisors asked us to override the mechanics of content insertion so that an article submitted by an author needs to be approved by a moderator before being featured for every visitor - as a result, we created our own Content table and a Status table linked to it. Also note that given the small scope of the website, we are also assuming a 1-to-1 correspondence between sections and categories.
The problem is that the Joomla UI lets any authenticated user upload articles and set them visible to all visitors through a "new article" button in any section. Is there a way to remove these buttons or override them with something of our own?
Haven't used the Joomla UI, but in traditional websites, you can use CSS or JS to hide/disable buttons.
For example, the "Ask Question" button in Stackoverflow (class name "aside-cta") can be disabled or hidden as follows:
CSS:
/* Disable the button */
. aside-cta {opacity: 0.1;pointer-events: none;}
/* OR hide the button */
. aside-cta {display:none }
Or Javascript can be used instead of CSS:
askBtn = document.querySelector('.aside-cta');
// For disabling the button :
askBtn.style.opacity = 0.1
askBtn.style["pointer-events"]= 'none';
// For hiding the button :
askBtn.style.display = 'none'

Targeting a new tab in Selenium

I have a test which essentially will click a link on the footer of the page. We have three of them and they all lead to different places:
A Google Docs form
A training page
A licensing page
The code below makes the right assertions and clicks the link:
if #link_selection.eql?('leave feedback')
#wait.until {#driver.find_element(css: => 'cell.feedback').click}
#wait.until {#driver.find_element(css: => 'a[href="https://docs.google.com/a/showmyhomework.co.uk/forms/d/1LP8BZ950TSXXDR1HuVz7yhv9Cp3h6scmQtNFqIRW_XI/viewform"').click}
puts "Leave feedback link clicked"
I've modularised it for each different link location.
When the link is clicked, it naturally opens in a new browser tab. I then wanted to extend the test to then view the tab which was opened and then make an assertion on that page. I wanted to ask how I can handle a new tab in Selenium and the way in that:
a. It asserts that the new tab is open (and switches to it)
b. It can then assert a heading or title of the page (so that the test is sure that the page has been opened.
The following code in c#, please feel free to change it to ruby.
// This gets the window handles of open available windows(also, tabs)
var availableWindows= driver.WindowHandles;
To switch to the new tab with respect to the title of the page:
string Title= "whateveryourpagetitleis";
foreach (string windowId in availableWindows)
{
string windowTitle = driver.SwitchTo().Window(windowId).Title;
if (windowTitle.ContainsIgnoreCase(title))
{
driver.SwitchTo().Window(windowId);
}
}
You can play around with the functions and then use your asserts accordingly. But, what you're looking for is WindowHandles

How to have only one tab open in wxribbon bar in wxpython?

I am building a GUI and I am using wxribbon for wxpython. I want to have only one tab(ribbon page) in when user starts my app, from where user can dynamically add more pages or can add panels and buttons to a page. I am able to achieve all the dynamic parts of ribbon. The only problem I have is that I am unable to start with only one ribbon page. When I define only one page, I don't see the ribbon bar(tab bar), what I see is only the page. Now, when I define two page in the beginning, then I see the bar. Can someone tell me what I code have to change in wxribbon so that I am able to have a tab bar visible with only one page in it. Any help would be great. Thanks!. The sample code I am using to add a page is as follows :
import wxRibbon as RB
self._ribbon = RB.RibbonBar(self, id = wx.ID_ANY)
page_1 = RB.RibbonPage(self._ribbon, WORKPIECE, "Workpiece", Bitmap("eye.xpm"))
page_2 = RB.RibbonPage(self._ribbon, wx.ID_ANY, "New Tab", Bitmap("empty.xpm"))
You need the flag RIBBON_BAR_ALWAYS_SHOW_TABS
try this:
self._ribbon = RB.RibbonBar(self, wx.ID_ANY, agwStyle = RB.RIBBON_BAR_DEFAULT_STYLE | RB.RIBBON_BAR_ALWAYS_SHOW_TABS)

Joomla 3.1 - Get active menu item url

As soon as I click on the "Media" item in my main menu, the following url is generated:
http://test.local/index.php/media-files
Now, I would like to create a module that is displayed only in media-files. Moreover, I want to retrieve the url of this active menu item.
So my question: How can I get the SEF-URL of an active menu item?
Thanks in advance,
enne
I think this might be what you want:
$app = JFactory::getApplication();
$menu = $app->getMenu()->getActive()->link;
echo JRoute::_($menu);
I've tested this as well, so let me know if it's what you require.

What are and how to use '#' in URLs

In my application I have a layout page for viewing the project:
This page have 4 sub-pages (Details, Photos, addresses and comments).
Example:
/myproject = Open the details page
/myproject/Photos = Open the Photos page
/myproject/Addresses = Opens the page addresses
/myproject/Comments = Open the page of comments
Question
How to use # to load pages via ajax to the URL?
Example
/myproject = Open the details page
/myproject#Photos = Open the Photos page
/myproject#Addresses = Opens the page addresses
/myproject#Comments = Open the page of comments
In page layout where I have four buttons, click on the photo for example, the page would be loaded via ajax. and url go
from /myproject
to /myproject#Photos
Resume
How to use '#' in asp.net MVC?
They are generally called URL fragments and are used as bookmarks on a page to navigate to different sections of that page. When clicked they will scroll down the currently loaded page to the matching tag name. I would recommend against using them as paths to different pages.
You can use them as bookmarks by specifying the fragment in the Htmlhelper:
#Html.ActionLink("My Photos", "Action", "Controller", null, null, "Photos", null, null)
Then in your Photos partial that represents the Photos sub-page, set the html id attribute to "Photos" in the div or label or whatever represents the beginning of the Photos partial. The link created with the #Html.ActionLink will look for a html element ID that matches the word you typed into the fragment.
See LinkExtensions.ActionLink Method for more details.
Sorry, brain fart there... You need everything client side...
I'd use the following jQuery plug-in to parse the URL fragment:
http://benalman.com/projects/jquery-urlinternal-plugin/
and then call MyDiv.Load('yourcontenthere') to load the content you'd like into the desired DIV.

Resources