How to Get the "Link A" of an article in Joomla 3? - joomla

I would like to know what is the code to get links "Link A" or "Link B" found in the panel to create an article, maybe you can enlighten me.
Image for example
http://goo.gl/v9jXU2

In article model there is a function called getItem($pk) where $pk is article id.
File: components\com_content\models\article.php
Call this function with passing article id. this will return all article related data.
In result you can find links "Link A" or "Link B" in urls variable like below:
$result = $model->getItem($articleId);
$result->urls contains information related to links "Link A" or "Link B". json_decode this data and use accordingly.

Related

Rendering custom "Integrate with Google" button - gapi.additnow

The render method of gapi.additnow takes as the second parameter an key-value pair object.
As in the following example:
gapi.additnow.render(
"el-id",
{"param1": "value_of_param1", "param2": "value_of_param2"}
)
Where can I find the list of available parameters to use.
I'm aiming on using the params to customize the "Integrate" button.
Not sure where you can get a full list, but the docs show "width" and "theme" as params in the example code:
https://developers.google.com/apps-marketplace/button#additnow-tag-attributes

Find a button on a web page looking for part of its InnerText string in Visual Studio

I am writing automated tests for a website. On the website there is a button that will have the inner text "All Open" + four random digits. For example: "All Open2957". Is there a way to find the button using only the "All Open" part of the string?
This does not work since the string is missing the four last digits:
HtmlSpan uIAllOpenPane = new HtmlSpan();
uIAllOpenPane.SearchProperties[HtmlDiv.PropertyNames.InnerText] = "All Open";
The simple answer is to use the PropertyExpressionOperator.Contains rather than PropertyExpressionOperator.EqualTo comparator and search for just the required text.
For recorded tests, find the control in the UI Map editor and view its properties panel. Click the "Search properties" field and then click the ellipsis. The window that appears allows the comparator and the required text to be altered.
For hand coded tests use code of the form:
uIAllOpenPane.SearchProperties.Add(HtmlDiv.PropertyNames.InnerText,
"All Open",
PropertyExpressionOperator.Contains);
According to this Microsoft blog the array index style (ie with [ and ]) as used in the question internally calls the SearchProperties.Add(...) but that style has no variation to specify ...Contains, so call the ...Add(...) explicitly.
Check this out
Button allOpenButton = (Button)BrowserWindow.ExecuteScript("allOpenButton = function(){var found; $('input[type=\"button\"]').each(function(){ if($(this).val().indexOf('All Open') > -1){ found = $(this);};}); return found;}; return allOpenButton();");
When trying to locate the controller I only got the FailedToPerformActionOnHiddenC‌​ontrolException. Eventually I was able to locate the DIV container that contained the controller I was trying to locate instead of focusing on finding the controller directly. After finding the container I could locate the controller using
HtmlSpan uIAllOpenPane = new HtmlSpan(container);
uIAllOpenPane.SearchProperties.Add(HtmlDiv.PropertyNames.InnerText, "All Open",
PropertyExpressionOperator.Contains);
The code from #AdrianHHH helped with the problem when part of the string is randomized each time you encounter the controller.

Vote for comments in posts function with Codeigniter and routing

I am trying to create posts with comments with CodeIgniter and I am trying to add voting for the comments with + and -.
But my problem is not actually this functionallity but more exactly creating the link and the method in controller/model for this.
I understand that there is some kind of link to methods.
If I have something like this:
public function like() {
echo 'Test Function';
}
and when I create link like this one sitename.com/posts/first-post/like theoritecally I will see blank page with "Test Function" text (and of course if I write proper routing rule but I cannor for now).
I can see a blank page with this working echo 'Test Function', but does this mean I have to load every methods and views for the entire page if I want to display the entire webpage with all the elements? I think that I mistake something very serious here but I don't know what.
The example with the "Create news" tutorial in ellislab.com didnt help me. They show something similar I think with /create/ section in the URL and create() methods.
If I have many links with functionallities do I have to add new routing rules for all of them? I really tried to search in Google and everywhere but I didnt find anything related.
Sorry for this lame question.
You need to use Ajax call and on callback you have to increase or decrease the count. For creating a link , once page is loading render the data and provided the default link like
for + http://<site.com>/<controller>/like?totalLike=<36>
for - http://<site.com>/<controller>/unlike?totalunLike=<3>
Once user will click + link then by using Ajax, call the controller method link/unlike and increase or decrease the count and repopulate the link again with fresh counter.
Hope it will resolve your problem.

Custom SEO article title in Joomla

While it's possible to manually enter the full title of a page displaying a category, how would I go about doing the same for an article page in Joomla 2.5?
The default is to use the article title as the page title, e.g. "How to care for goldfish", with an option to add the site name.
What I want is to have the title as follows:
How to care for goldfish | Fish care guides | FishSite.com
The obvious solution would be just to put all that in the title of the article, but then I'd have a problem in the "Latest articles" module, it would become unreadable with all the extra text.
How to solve this? Plugin, coding, or some clever solution? It needs to be more or less automatic though, I can access the Joomla database and change each page title manually but that wouldn't be feasible. If manual text entry is needed, it has to be in Joomla.
The plugin system responds to events, so the easiest solution would be a either a Content or System plugin that manipulates the Title by appending the relevant information prior to display.
I think with a content plugin you could use the onContentPrepare event to do all the work.
In rough psuedo code (i.e. this won't run), I would probably end up with something like this:
public function onContentPrepare($context, &$article, &$params, $page = 0)
{
// Don't run this plugin when the content is being indexed
if ($context == 'com_finder.indexer') {
return true;
}
// Perform a sanity check to make sure we're on an article layout
// Build new title
}

How to set titles for the web pages?

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 :).

Resources