Joomla 2.5 jroute trouble with localhost - php

I wrote a component and i have trouble using jroute for building links
Example : In my default tmpl in admin part,
if use $link = ''.JRoute::_( 'index.php?option=' . $option . '&task=tournoi.edit&id=' . $row->tournois_id );
or
$link = JRoute::_( 'index.php?option=' . $option . '&task=tournoi.edit&id=' . $row->tournois_id );
i get
http://joomla_new/administrator/index.php?option=com_tournois&task=generatereport&tid=1" where localhost is missing.
if i just add space like this : $link = ' '.JRoute::_( 'index.php?option=' . $option . '&task=tournoi.edit&id=' . $row->tournois_id );
i get
http://localhost/%20/Joomla_new/administrator/index.php?option=com_tournois&task=tournoi.edit&id=1
Anyone has an idea ?
Thanks !

Related

How do I disable the href link on this code so that it doesn't return Void(0) on the URL?

I'm displaying a woocommerce notice with a popup shortcode inside. When you try to click it, it works but redirects the URL to ' /void(0 '. How to amend this code to prevent this from happening. Thanks
$message = __( 'Please Sign Up or Login', 'my-plugin ' ) . do_shortcode('[arm_form popup="true"]');
wc_add_notice( $message );
I'm using a plugin called AR Member , I had to change the following:
wp-content/plugins/armember/core/classes/class.arm_member_forms.php
Line: 1699
Before:
$popup_content .= '<a href="javascript:void(0)" id="' . $popupLinkID . '"
class="' . $popupLinkClass . ' arm_form_popup_ahref" ' . $popupLinkAttr . '>'
. $link_title . '</a>';
After:
$popup_content .= '<a href="#" id="' . $popupLinkID . '" class="' .
$popupLinkClass . ' arm_form_popup_ahref" ' . $popupLinkAttr . '>' .
$link_title . '</a>';
The downside is that when the plugin updates I will have to update it again, maybe someone could advise if this can be pulled into theme functions in some way?
Thanks to #Basharmal for a pointer in the right direction :-)
Please change the plugin code .
Go to
popup-anything-on-click/includes/shortcode/popupaoc-popup-shortcode.php
find the code line no 79 to 84 prnt.sc/q882pq
just replace the code
“javascript:void(0);”
to
“#”
this way
prnt.sc/q883t9 Note:-In
the future if plugin will update your code will lose

php in header url error

I have just a quick question. i was using a normal html link tag to redirect to a paypal checkout page and it was working fine even when i had php inside the url. but when i was using it in a php header
the url cuts off where i enter the php.
header('location: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=XXXX&lc=UK&item_name=<? echo $product . " " . $server ?>&amount=<? echo $xprice1; ?>%2e00&currency_code=GBP&button_subtype=services&no_note=0&bn=PP%2dBuyNowBF%3abtn_buynowCC_LG%2egif%3aNonHostedGuest');
You are placing the PHP code inside of the location redirect as a string. The code is not being evaluated as PHP.
Try this instead:
<?php
$url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=XXXX&lc=UK&item_name=" . $product . " " . $server ."&amount=" . $xprice1 . "%2e00&currency_code=GBP&button_subtype=services&no_note=0&bn=PP%2dBuyNowBF%3abtn_buynowCC_LG%2egif%3aNonHostedGuest";
header('location: ' . $url);
Or, you could keep it in one line like so:
<?php
header('location: ' . "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=XXXX&lc=UK&item_name=" . $product . " " . $server ."&amount=" . $xprice1 . "%2e00&currency_code=GBP&button_subtype=services&no_note=0&bn=PP%2dBuyNowBF%3abtn_buynowCC_LG%2egif%3aNonHostedGuest");
header('location: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=XXXX&lc=UK&item_name=<? echo $product' . " " . '$server ?>&amount=<? echo $xprice1; ?>%2e00&currency_code=GBP&button_subtype=services&no_note=0&bn=PP%2dBuyNowBF%3abtn_buynowCC_LG%2egif%3aNonHostedGuest');
This may solve your problem. Please dont forget to tick the answer right if it works.

buddy press profile link not going to correct place

I created a bp-custom.php and regrouped the menu items fine. But now i am trying to add a link to go to /site/members. It list all the members.
When i add it though it goes under the profile I am viewing. I am redirecting to a wordpress page if that helps. Or is there a better way to do this.
Ex :
http://website.com/log-in/members/username/members/
I want it to go just here
http://website.com/log-in/members/
I would love to learn how to just put a url and no slug but whatever works. I do not know why it keeps referencing that signed in /member/username. I have even tried parent url and that did not work. I might have been using parent url syntax wrong.
Here is the function
function mb_bp_profile_menu_posts() {
global $bp;
bp_core_new_nav_item(
array(
'name' => 'Members',
'slug' => 'members',
'position' => 60,
)
);
}
I know that i can create .htaccess for this. But I don't want to do it.
May i know what is the clean way (alternate way) to do this?
I have tried what the user said in comment below and found in bp-members-template this function. I then added the part in bold to add the link but that did not work. I am just adding a google link for testing only.
function bp_get_displayed_user_nav() {
global $bp;
foreach ( (array) $bp->bp_nav as $user_nav_item ) {
if ( empty( $user_nav_item['show_for_displayed_user'] ) && !bp_is_my_profile() )
continue;
$selected = '';
if ( bp_is_current_component( $user_nav_item['slug'] ) ) {
$selected = ' class="current selected"';
}
if ( bp_loggedin_user_domain() ) {
$link = str_replace( bp_loggedin_user_domain(), bp_displayed_user_domain(), $user_nav_item['link'] );
} else {
$link = trailingslashit( bp_displayed_user_domain() . $user_nav_item['link'] );
}
echo apply_filters_ref_array( 'bp_get_displayed_user_nav_' . $user_nav_item['css_id'], array( '<li id="' . $user_nav_item['css_id'] . '-personal-li" ' . $selected . '><a id="user-' . $user_nav_item['css_id'] . '" href="' . $link . '">' . $user_nav_item['name'] . '</a></li>', &$user_nav_item ) );
**echo "<a href='http://www.google.com'>Google</a>"; }**
}
The bp_core_new_nav_item function is used to add a link to the user's navigation which explains why you're seeing URLs like /members/username/members/ when clicking on the tab. I don't think bp_core_new_nav_item is the right approach here.
An alternative approach would be to replace the function in your theme template that outputs the navigation with your own custom menu.
See this article on the BP Template Hierarchy which shows you how you can set up your own templates:
http://codex.buddypress.org/themes/theme-compatibility-1-7/template-hierarchy/

URL parsing and sessions in Reservation system

I am creating a flight/hotel reservation system like farecompare.com Farecompare parse values to other sites and create sessions other sites too. Anyone tell me how they create sesssions in it. I can parse url but i am not able to create sessions.
public function flight($depart, $return, $from, $to, $type, $class,
$adults, $seniors, $children) {
$dep = explode("/", $depart);
$ret = explode("/", $return);
if ($type == 'RoundTrip') {
$expurl = 'http://www.expedia.co.in/Flights-Search?trip=' .
strtolower($type) . '&leg1=from%3A' . $from .
'%29%2Cto%3A' . $to .
'%29%2Cdeparture%3A' . $dep[1] .
'/'.$dep[0].'/'.$dep[2].
'TANYT&leg2=from%3A' . $to .
'%29%2Cto%3A' . $from .
'%29%2Cdeparture%3A' .
$ret[1].'/'.$ret[0].'/'.$ret[2] .
'TANYT&passengers=children%3A' . $children .
'%2Cadults%3A' . $adults .
'%2Cseniors%3A' . $seniors .
'%2Cinfantinlap%3AY&options=cabinclass%3Aeconomy'.
'%2Cnopenalty%3AN%2Csortby%3Aprice&mode=search';
echo 'Expedia';
} else {
$type = 'oneway';
$expurl = 'http://www.expedia.co.in/Flights-Search?trip='.
strtolower($type) . '&leg1=from%3A' . $from .
'%29%2Cto%3A' . $to . '%29%2Cdeparture%3A' .
$dep[1].'/'.$dep[0].'/'.$dep[2] .
'TANYT&passengers=children%3A' . $children .
'%2Cadults%3A' . $adults .
'%2Cseniors%3A' . $seniors .
'%2Cinfantinlap%3AY&options=cabinclass%3Aeconomy'.
'%2Cnopenalty%3AN%2Csortby%3Aprice&mode=search';
echo 'Expedia';
}
}
I worked on Expedia by parsing url to get data but there are other sites like cheapoait, travelocity etc which uses sessions. How to create sessions?
I would assume they store it in the cookies.
We can not access session data of other domain on our site. Data transfer done using web services SOAP OR REST in form of XML. That can be retrieved on other domain and store in session and cookies and use for calculation in website.

Kunena for Joomla uses nofollow for internal links

For some reason Kunena puts nofollow links for everything internal. This makes sense for all external links but certainly not for internal ones. I want Google to index the paths associated with the forum posts I have.
I'm hoping someone knows how to remove the nofollow links. It looks like this file is the main one: components/com_kunena/lib/kunena.link.class.php
There are a few functions where I remove the nofollow links such as:
static function GetHrefLink($link, $name, $title = '', $rel = 'nofollow', $class = '', $anker = '', $attr = '') {
return '<a ' . ($class ? 'class="' . $class . '" ' : '') . 'href="' . $link . ($anker ? ('#' . $anker) : '') . '" title="' . $title . '"' . ($rel ? ' rel="' . $rel . '"' : '') . ($attr ? ' ' . $attr : '') . '>' . $name . '</a>';
}
//
// Basic universal href link
//
static function GetSefHrefLink($link, $name, $title = '', $rel = 'nofollow', $class = '', $anker = '', $attr = '') {
$uri = $link instanceof JURI ? $link : JURI::getInstance($link);
if ($anker) $uri->setFragment($anker);
return JHTML::_('kunenaforum.link', $uri, $name, $title, $class, $rel, $attr);
}
I've tried removing the parameter everywhere, I tried just leaving it empty and I've tried using follow as a replacement. I've also tried looking for every single place where nofollow is shown in the whole Kunena component and tried removing those. Still no luck. Anyone with any ideas?
Kunena: 2.0.2
Joomla: 2.5.7
You dont need to change nofollow because google will index whole topic and categories. Check url for topic if its indexed. And add RSS and sitemap to google webmaster. You can configure RSS# kunena settings
Resolved this by changing this file: administrator/components/com_kunena/libraries/view.php
Find:
public function getTopicLink
Change this line:
return JHTML::_('kunenaforum.link', $uri, $content, $title, $class, 'nofollow');
to:
return JHTML::_('kunenaforum.link', $uri, $content, $title, $class, 'follow');
This exists in several spots.
If I understand your original concern, you want to remove all the rel="nofollow" references.
I would do this with a free component called ReReplacer. http://www.nonumber.nl/extensions/rereplacer
Create a rereplacer item that searches for rel="nofollow" and replaces it with rel="follow".
I did this for a forum of Joomla users that we want them to have follow links in their signatures.
If you buy the pro version of rereplacer then you can specify the replacement for only Kunena.

Categories