Friday, 08 December 2017
  5 Replies
  1.4K Visits
0
Votes
Undo
Hi experts,

I'm programming some php and want to have a hyperlink to a specific location.

I allready made a JQuery and got the value 'ev_id'.
Now I want to know how I can create a link to the event-detail-site.

What do I have to do?

Thanks and regards,
Berndi
Tuesday, 12 December 2017 10:35
·
#196027
Accepted Answer
0
Votes
Undo
Yikes I don't like seeing that code in a template.

So this is very wrong:

$link = '<a style="text-decoration:none;color:' . $color . ';" href="/component/jevents/?task=icalrepeat.detail&uid='%20.%20$zeile[$i]['uid']%20.%20'">' . $zeile[$i]['summary'] . '<i style="font-size:12px!important" class="fa fa-external-link" aria-hidden="true"></i></a>';



You are assuming it is an SEF link by default, this shouldn't be done. It should be more like:


$eventid = 'You Event ID Var here';
$Itemid = 'You Menu Item ID Var here';
$url = JRoute::_("index.php?option=com_jevents&task=icalevent.detail&evid=".$eventid."&Itemid=".$itemid);
$link = '<a style="text-decoration:none;color:' . $color . ';" href="' . $url . '">' . $zeile[$i]['summary'] . '<i style="font-size:12px!important" class="fa fa-external-link" aria-hidden="true"></i></a>';


Something like that should do it for you. JURI isn't of any use here since you don't need to fetch a URL.

Many thanks
Tony

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!Join the JEvents club today!

Tuesday, 12 December 2017 10:35
·
#196027
Accepted Answer
0
Votes
Undo
Yikes I don't like seeing that code in a template.

So this is very wrong:

$link = '<a style="text-decoration:none;color:' . $color . ';" href="/component/jevents/?task=icalrepeat.detail&uid='%20.%20$zeile[$i]['uid']%20.%20'">' . $zeile[$i]['summary'] . '<i style="font-size:12px!important" class="fa fa-external-link" aria-hidden="true"></i></a>';



You are assuming it is an SEF link by default, this shouldn't be done. It should be more like:


$eventid = 'You Event ID Var here';
$Itemid = 'You Menu Item ID Var here';
$url = JRoute::_("index.php?option=com_jevents&task=icalevent.detail&evid=".$eventid."&Itemid=".$itemid);
$link = '<a style="text-decoration:none;color:' . $color . ';" href="' . $url . '">' . $zeile[$i]['summary'] . '<i style="font-size:12px!important" class="fa fa-external-link" aria-hidden="true"></i></a>';


Something like that should do it for you. JURI isn't of any use here since you don't need to fetch a URL.

Many thanks
Tony

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!Join the JEvents club today!

Monday, 11 December 2017 22:31
·
#196013
0
Votes
Undo
...and how should that look like?
Saturday, 09 December 2017 15:22
·
#195977
0
Votes
Undo
you could use Juri and append the event id to that url

https://api.joomla.org/cms-3/classes/JUri.html
Saturday, 09 December 2017 09:30
·
#195973
0
Votes
Undo
I'm tring to write a module für jevents, bu for now I run a php script inside my template.

$color = ($params['color'] == "") ? "#444444" : $params['color'];
$speed = ($params['speed'] == "") ? 6 : $params['speed'];

function array_orderby()
{
$args = func_get_args();
$data = array_shift($args);
foreach ($args as $n => $field) {
if (is_string($field)) {
$tmp = array();
foreach ($data as $key => $row)
$tmp[$key] = $row[$field];
$args[$n] = $tmp;
}
}
$args[] = &$data;
call_user_func_array('array_multisort', $args);
return array_pop($args);
}

$db = JFactory::getDbo();

$q1 = $db->getQuery(true);
$q1
->SELECT(array('a.dtstart', 'a.summary', 'a.dtend', 'a.multiday', 'b.uid'))
->FROM($db->quoteName('tgs1887_jevents_vevdetail', 'a'))
->JOIN('INNER', $db->quoteName('tgs1887_jevents_vevent', 'b') . ' ON (' . $db->quoteName('b.detail_id') . ' = ' . $db->quoteName('a.evdet_id') . ')')
->WHERE($db->quoteName('b.catid') . ' = 112 AND ' . $db->quoteName('b.state') . ' > 0')
;

$db->SetQuery("SELECT DISTINCT a.dtstart, a.summary, a.dtend, a.multiday, b.uid FROM `tgs1887_jevents_vevdetail` as a, `tgs1887_jevents_vevent` as b, `tgs1887_jev_customfields` as c WHERE c.evdet_id = a.evdet_id AND c.name = 'Ticker' AND c.value = 1 AND b.state > 0 UNION($q1)");

$data = $db->loadAssocList();
$zeile = array_orderby($data, 'dtstart', SORT_ASC);

$ausgabe = "Wichtige Termine: ";
$wochentage = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");

for ($i = 0; $i < count($zeile); $i++) {
/* Doppelte Einträge vermeiden */
if ($i > 0) {
while ($zeile[$i]['summary'] == $zeile[$i - 1]['summary'] AND $zeile[$i]['dtstart'] == $zeile[$i - 1]['dtstart']) {
$i++;
}
}

$dtstart = date("H:i", $zeile[$i]['dtstart'] + 7200);
$dtend = date("H:i", $zeile[$i]['dtend'] + 7200);
$link = '<a style="text-decoration:none;color:' . $color . ';" href="/component/jevents/eventdetail/0/-/-">' . $zeile[$i]['summary'] . '<i style="font-size:12px!important" class="fa fa-external-link" aria-hidden="true"></i></a>';

// $ausgabe = $ausgabe."<i><small>[".date("d.m.Y",$zeile[$i]['dtstart'] + 7200)."".date("d.m.Y",$zeile[$i]['dtend'] + 7200)."]</small></i>";

if ($zeile[$i]['multiday'] = 1) {

if ($zeile[$i]['dtstart'] < time() and $zeile[$i]['dtend'] > time()) {
$ausgabe = $ausgabe."noch bis zum";
if ($dtstart == "00:00" and $dtend == "23:59") {
$datum = date("d.m.Y",$zeile[$i]['dtend'] + 7200);
$wochentag = $wochentage[date("w",$zeile[$i]['dtend'] + 7200)];
$ausgabe = $ausgabe.$wochentag.",".$datum."-".$zeile[$i]['summary'];
$ausgabe = $ausgabe."+++";
}
else {
$datum = date("d.m.Y",$zeile[$i]['dtend']);
$wochentag = $wochentage[date("w",$zeile[$i]['dtend'] + 7200)];
$ausgabe = $ausgabe.$wochentag.",".$datum."-".$zeile[$i]['summary'];
$ausgabe = $ausgabe."+++";
}
}

if ($zeile[$i]['dtstart'] < time() and date("d.m.Y",$zeile[$i]['dtend']) == date("d.m.Y",time())) {
$ausgabe = $ausgabe."heute";
$ausgabe = $ausgabe."-".$zeile[$i]['summary'];
$ausgabe = $ausgabe."+++";
}

}

if ($zeile[$i]['dtstart'] > time()) {
if ($dtstart == "00:00" and $dtend == "23:59") {
$datum = date("d.m.Y",$zeile[$i]['dtstart'] + 7201);
$wochentag = $wochentage[date("w",$zeile[$i]['dtstart'] + 7201)];
// $ausgabe = $ausgabe."[".date("d.m.Y",$zeile[$i]['dtend'] + 7200)."".date("d.m.Y",time())."]";
$ausgabe = $ausgabe.$wochentag.",".$datum."-".$zeile[$i]['summary'];
$ausgabe = $ausgabe."+++";
}
else {
$datum = date("d.m.Y",$zeile[$i]['dtstart'] + 7200);
$wochentag = $wochentage[date("w",$zeile[$i]['dtstart'] + 7200)];
// $ausgabe = $ausgabe."[".date("d.m.Y",$zeile[$i]['dtend'] + 7200)."".date("d.m.Y",time())."]";
// $ausgabe = $ausgabe.$wochentag.",".$datum."-".$zeile[$i]['summary'];
$ausgabe = $ausgabe.$wochentag.",".$datum."-".$link;
$ausgabe = $ausgabe."+++";
}
}

}

echo "<div class=\"row\"></div><div class=\"col-xs-12 tgs_lauftext\">";
echo '<marquee style="font-size: 20pt; color: ' . $color . '; padding-top: 5px;" behavior="scroll" scrollamount="' . $speed . '" direction="left">';

if (strlen($ausgabe) < 20) {
echo "Es liegen zur Zeit keine öffentlichen Termine vor.";
} else {
echo $ausgabe."";
echo $ausgabe."";
echo $ausgabe."";
echo $ausgabe."";
}
echo "</marquee></div>";


with the line
    $link = '<a style="text-decoration:none;color:' . $color . ';" href="/component/jevents/eventdetail/0/-/-">' . $zeile[$i]['summary'] . '<i style="font-size:12px!important" class="fa fa-external-link" aria-hidden="true"></i></a>';
I try to generate a link with the uid, but it dosen't work either.
Saturday, 09 December 2017 09:11
·
#195970
0
Votes
Undo
Hello Berndi,

Where are you getting the link from in Joomla! or an outside application?

Many thanks
Tony

JEvents Club members can get priority forum support at the Support Forum. As well as access to a variety of custom JEvents addons and benefits. Join the JEvents club today!Join the JEvents club today!

  • Page :
  • 1
There are no replies made for this post yet.

Members Area

Show your support

Unlike many Joomla calendars we do not charge to download JEvents - please show your support for this project by becoming a member of the JEvents Club Club members get access to early releases, exclusive member support forums, and Silver and Gold members can use many exciting JEvents addons

Your membership will ensure that JEvents continues to be the best events calendar for Joomla.