Links im Kalender
Links im Kalender
Hallo,
Ist es möglich, im Kalender, nur die Objekte zu verlinken, für die im Feld AID/Alias/URL eine Angabe gemacht wurde?
Grüße
André
Ist es möglich, im Kalender, nur die Objekte zu verlinken, für die im Feld AID/Alias/URL eine Angabe gemacht wurde?
Grüße
André
-
- Posts: 18
- Joined: Mon 26. Jan 2009, 22:17
Re: Links im Kalender
Hallo,
ich stehe gerade vor einem ähnlichen Problem. Deine Frage scheint lösbar zu sein, wenn man im Kalender RT die Angabe "href" weglässt, werden nur Links bei ausgefülltem Feld "AID/Alias/URL" erzeugt. Leider akzeptiert das Feld nur Zahlen und verlinkt dann auch nicht auf die richtige Artikel-ID.
Soweit meine Erkenntnisse,
Martin
ich stehe gerade vor einem ähnlichen Problem. Deine Frage scheint lösbar zu sein, wenn man im Kalender RT die Angabe "href" weglässt, werden nur Links bei ausgefülltem Feld "AID/Alias/URL" erzeugt. Leider akzeptiert das Feld nur Zahlen und verlinkt dann auch nicht auf die richtige Artikel-ID.
Soweit meine Erkenntnisse,
Martin
Re: Links im Kalender
Hi,
lasse ich die die Angabe "href" weg, wird bei mir nichts verlinkt wenn im Feld "AID/Alias/URL" ein Alias, eine ID oder eine URL steht.
Kann auch nicht funktionieren, da in der frontend_render Datei "include/inc_module/mod_calendar/inc/calendar.class.php" folgendes steht:
HREF ist aus meiner Sicht eher für einen Teaser gedacht, der dann direkt das Datum in der Liste anspringen kann. (Was allerdings ohne eine Erweiterung auch noch nicht funktioniert).
Folgende Paramter müssen dazu im Template eingeführt werden, dann ist auch "AID/Alias/URL" verfügbar, hat also mit href nichts zu tun.
Z.B.:
Z.B. mit dem Eintrag im Modul im Feld "AID/Alias/URL" :
Der Kalender überzeugt durch seine Einfachheit, ein großes Plus.
Allerdings ist er leider nicht so ganz komplett (muss also erweitert werden), es fehlen einige Dinge, wie z.B. eine brauchbare BE Kurzübersicht oder die Einbindung des Wysiwyg Textes oder des Bildes.
Z.B. wüßte ich nicht wie so ein "more"-Link generiert werden soll mit dem vorhandenen Code. Bsp.: http://www.iba-stadtumbau.de/index.php?kalender-2008 (16.04.2008) Natürlich geht alles, jedoch muss das dann hinzuprogrammiert werden.
Eine Alternative die funktioniert: http://web.casa-loca.com/index.php?module - wesentlich komplexer bei der Einrichtung und den Funktionen.
Knut
lasse ich die die Angabe "href" weg, wird bei mir nichts verlinkt wenn im Feld "AID/Alias/URL" ein Alias, eine ID oder eine URL steht.
Kann auch nicht funktionieren, da in der frontend_render Datei "include/inc_module/mod_calendar/inc/calendar.class.php" folgendes steht:
Code: Select all
$href = $this->href ? $this->href . '&show_date='.date('Y-m-d', $date['calendar_start_date']).'_'.$date['calendar_id'] : '';
Folgende Paramter müssen dazu im Template eingeführt werden, dann ist auch "AID/Alias/URL" verfügbar, hat also mit href nichts zu tun.
Code: Select all
[URL]{URL}[/URL]
und
[TARGET]{TARGET}[/TARGET]
Z.B.:
Code: Select all
[URL]<a href="{URL}" [TARGET]{TARGET}[/TARGET]> >>Artikellink >></a>[/URL]
Code: Select all
articlealias _blank
Allerdings ist er leider nicht so ganz komplett (muss also erweitert werden), es fehlen einige Dinge, wie z.B. eine brauchbare BE Kurzübersicht oder die Einbindung des Wysiwyg Textes oder des Bildes.
Z.B. wüßte ich nicht wie so ein "more"-Link generiert werden soll mit dem vorhandenen Code. Bsp.: http://www.iba-stadtumbau.de/index.php?kalender-2008 (16.04.2008) Natürlich geht alles, jedoch muss das dann hinzuprogrammiert werden.
Eine Alternative die funktioniert: http://web.casa-loca.com/index.php?module - wesentlich komplexer bei der Einrichtung und den Funktionen.
Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
-
- Posts: 18
- Joined: Mon 26. Jan 2009, 22:17
Re: Links im Kalender
Sorry Flip-Flop,
deiner Aussage muss ich widersprechen. Mittlerweile funktioniert es bei mir, dass bei einer Eingabe der Artikel-ID im Feld "AID/Alias/URL" ein Link erzeugt wird. Dies funktioniert allerdings nur bei Eingabe der Artikel-ID (AID) als reine Zahl. Alle Eingaben mit Buchstaben drin werden gelöscht.
Zur Sicherheit noch meine Konfigurationsdateien, die sich von deinen auch zu unterscheiden scheinen:
phpwcmsCalendar.class.php
init-calendar.php
Mein Template:
soweit, so gut,
Martin
deiner Aussage muss ich widersprechen. Mittlerweile funktioniert es bei mir, dass bei einer Eingabe der Artikel-ID im Feld "AID/Alias/URL" ein Link erzeugt wird. Dies funktioniert allerdings nur bei Eingabe der Artikel-ID (AID) als reine Zahl. Alle Eingaben mit Buchstaben drin werden gelöscht.
Zur Sicherheit noch meine Konfigurationsdateien, die sich von deinen auch zu unterscheiden scheinen:
phpwcmsCalendar.class.php
Code: Select all
<?php
/*************************************************************************************
Copyright notice
(c) 2002-2008 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
This script is part of PHPWCMS. The PHPWCMS web content management system is
free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
A copy is found in the textfile GPL.txt and important notices to the license
from the author is found in LICENSE.txt distributed with these scripts.
This script is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/
/**
* phpwcms Calendar frontend render class
*/
class phpwcmsCalendar {
var $mode = 'simple';
var $dates = array();
/**
* Initialize class
*/
function phpwcmsCalendar() {
// current
$this->current_date = getdate();
// set today 00:00:00 as start date
$this->date_start = mktime(0, 0, 0, $this->current_date['mon'], $this->current_date['mday'], $this->current_date['year']);
// by default date_start + 1 year
$this->date_end = mktime(0, 0, 0, $this->current_date['mon'], $this->current_date['mday'], $this->current_date['year'] + 1) - 1;
$this->dbReset();
}
/**
* Reset db base vars
*/
function dbReset() {
$this->where = '';
$this->select = '*';
$this->join_on = '';
$this->group_by = '';
$this->order_by = 'calendar_start ASC';
$this->limit = 0;
}
function defaultTemplate() {
$this->template = '';
$this->href = '';
}
/**
* search string for calendar tag and parse
*/
function parse(& $string) {
if( preg_match_all('/\{CALENDAR:(.*?)\}/s', $string, $matches) ) {
if( isset($matches[1]) ) {
foreach($matches[1] as $key => $value) {
$this->parse_match($value);
$result = $this->render();
// replace calendar by result
$string = str_replace($matches[0][$key], $result, $string);
}
$string = html_parser($string);
}
}
}
function render() {
$items = array();
foreach($this->dates as $key => $date) {
$date['calendar_refid'] = intval($date['calendar_refid']);
if($date['calendar_refid'] > 0) {
$href = 'index.php?aid='.$date['calendar_refid'];
} else {
$href = $this->href ? $this->href . '&show_date='.date('Y-m-d', $date['calendar_start_date']).'_'.$date['calendar_id'] : '';
}
$items[$key] = $this->template;
$items[$key] = render_cnt_template($items[$key], 'HREF', $href);
$items[$key] = render_cnt_template($items[$key], 'TITLE', html_specialchars($date['calendar_title']));
$items[$key] = render_cnt_template($items[$key], 'TEXT', plaintext_htmlencode($date['calendar_teaser']));
$items[$key] = render_cnt_template($items[$key], 'PLACE', html_specialchars($date['calendar_where']));
$items[$key] = render_cnt_date($items[$key], $date['calendar_start_date'], $date['calendar_start_date'], $date['calendar_end_date']);
//---------------
// 0 :1 :2 :3 :4 :5 :6 :7 :8
// dbid:filename:hash:extension:width:height:caption:position:zoom
// $image = ($crow["acontent_image"]) ? explode(":", $crow["acontent_image"]) : false ;
// http://de.php.net/manual/de/function.serialize.php
// http://de.php.net/unserialize
$image_temp = @unserialize($date['calendar_object']);
// dumpVar ($image_temp);
$image_id = $image_temp['image']['id'];
$image_name = $image_temp['image']['name'];
$image_zoom = getImageCaption($image_temp['image']['zoom']);
$image_light = getImageCaption($image_temp['image']['lightbox']);
// following is default for the exploded $caption
// [0] caption text
// [1] alt text for image
// [2] link -> array(0 => link, 1 => target)
// [3] title text -> if empty alt text will be used
// [4] copyright information
$image_capt = getImageCaption($image_temp['image']['caption']);
// dumpVar ($image_capt);
$image_text = $image_capt[0];
$image_alt = $image_capt[1];
$image_link = $image_capt[2];
$image_title = $image_capt[3];
$image_copyr = $image_capt[4];
// get segments: cmsimage.php/%WIDTH%x%HEIGHT%x%CROP%x%QUALITY%/%HASH%.%EXT%
$image_calendar = '<img src="'.PHPWCMS_URL.'img/cmsimage.php/100x100/'.$image_id.'" alt="'.$image_alt.'" />';
// dumpVar ($image_calendar);
// Bildaufbereitung f�r zoom u. LightBox siehe Bilder div
// /include/inc_front/content/cnt29.article.inc.php
//----------------
// KH Wysiwyg http://forum.phpwcms.org/viewtopic.php?p=107020#p107020
$items[$key] = render_cnt_template($items[$key], 'TEXTLONG', $date['calendar_text']);
// KH Bilder http://forum.phpwcms.org/viewtopic.php?p=107159#p107159
$items[$key] = render_cnt_template($items[$key], 'IMAGE_CALENDAR', $image_calendar);
}
return implode(LF, $items);
}
/**
* Parse matched replacement tag
*/
function parse_match($match='') {
$default = array();
$match = trim($match);
// set query defaults
$this->dbReset();
$this->defaultTemplate();
if($match !== '' && strpos($match, '=') !== FALSE ) {
// oh yes fix, in case LF was converted to <br /> by phpwcms
$match = str_replace('<br />', LF, $match);
// result is a normal array
$match = parse_ini_str($match, false);
$default['items'] = isset($match['items']) ? intval($match['items']) : 0;
$default['template'] = empty($match['template']) ? '' : trim($match['template']);
$default['lang'] = empty($match['lang']) ? '' : trim($match['lang']);
$default['tag'] = empty($match['tag']) ? '' : trim($match['tag']);
$default['tagmode'] = empty($match['tagmode']) ? 'OR' : ( trim($match['tagmode']) == 'AND' ? 'AND' : 'OR' );
$default['href'] = empty($match['href']) ? '' : trim($match['href']);
} else {
// base format
// 2,main_page.tmpl,de en, href, tag1, tag2 tag2, tag3
// [item count,[template[,language(en de - separated by space)[, href, tags, tag, tag, tag]]]]
$match = explode(',', $match, 5);
$default['items'] = intval($match[0]);
$default['lang'] = empty($match[1]) ? '' : $match[1];
$default['template'] = empty($match[2]) ? '' : trim($match[2]) ;
$default['href'] = empty($match[3]) ? '' : trim($match[3]);
$default['tag'] = empty($match[4]) ? '' : $match[4];
$default['tagmode'] = 'OR';
}
$this->limit = $default['items'];
$this->href = $default['href'];
if($default['template'] !== '') {
$default['template'] = preg_replace('/[\/\\:]/', '', $default['template']);
if(is_file(PHPWCMS_TEMPLATE.'calendar/'.$default['template'])) {
$this->template = file_get_contents(PHPWCMS_TEMPLATE.'calendar/'.$default['template']);
$this->template = str_replace('{STARTDATE', '{LIVEDATE', $this->template);
$this->template = str_replace('{ENDDATE', '{KILLDATE', $this->template);
} else {
$default['template'] = '';
}
}
$where = array();
if($default['lang'] !== '') {
$default['lang'] = str_replace(',', ' ', preg_replace('/[^a-z\-]/', '', strtolower($default['lang'])));
$default['lang'] = array_intersect( convertStringToArray( $default['lang'], ' '), $GLOBALS['phpwcms']['allowed_lang']);
if(count($default['lang'])) {
$where[] = "calendar_lang IN ('" . implode("','", $default['lang']) . "')";
}
}
if($default['tag'] !== '') {
$default['tag'] = convertStringToArray( strtolower( $default['tag'] ), ',');
if(count($default['tag'])) {
$tag_where = array();
foreach($default['tag'] as $tag) {
$tag_where[] = "cat_name='".aporeplace($tag)."'";
}
if(count($tag_where)) {
$where[] = '(' . implode(' '.$default['tagmode'] . ' ', $tag_where) . ')';
$this->join_on = 'LEFT JOIN '.DB_PREPEND.'phpwcms_categories ON cat_pid=calendar_id';
$this->group_by = 'calendar_id';
}
};
}
$this->where = implode(' AND ', $where);
$this->getDate();
return $default;
}
function getDate() {
// 1 daily
// 2 Every weekday (Mon-Fri)
// 3 Every Mon., Wed. and Fri.
// 4 Every Tues. and Thurs.
// 5 Weekly
// 6 Monthly
// 7 yearly
if(is_string($this->order_by) && trim($this->order_by) != '') {
$this->order_by = ' ORDER BY '.$this->order_by;
} else {
$this->order_by = '';
}
if(is_int($this->limit) && $this->limit > 0) {
$this->limit = ' LIMIT '.$this->limit;
} else {
$this->limit = '';
}
if(is_string($this->group_by) && trim($this->group_by) != '') {
$this->group_by = ' GROUP BY '.$this->group_by;
} else {
$this->group_by = '';
}
$sql = 'SELECT '. $this->select .', ';
$sql .= "UNIX_TIMESTAMP(calendar_start) AS calendar_start_date, ";
$sql .= "UNIX_TIMESTAMP(calendar_end) AS calendar_end_date ";
$sql .= ' FROM '.DB_PREPEND.'phpwcms_calendar pc ';
$sql .= $this->join_on;
$sql .= ' WHERE ';
$sql .= 'calendar_status = 1 AND ';
$sql .= "calendar_start >= '".aporeplace( date('Y-m-d H:i:s', $this->date_start) )."' AND ";
$sql .= "calendar_start <= '".aporeplace( date('Y-m-d H:i:s', $this->date_end) )."'";
if(!empty($this->where)) {
$sql .= ' AND ' . $this->where;
}
$sql .= $this->group_by;
$sql .= $this->order_by;
$sql .= $this->limit;
$this->dates = _dbQuery($sql);
if( !$this->dates ) {
$this->dates = array();
}
}
}
?>
Code: Select all
<?php
/*************************************************************************************
Copyright notice
(c) 2002-2008 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
This script is part of PHPWCMS. The PHPWCMS web content management system is
free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
A copy is found in the textfile GPL.txt and important notices to the license
from the author is found in LICENSE.txt distributed with these scripts.
This script is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/
/**
* Usage: sample Replacement Tag
*
* {CALENDAR:
* items=100
* template=dates_list_de.html
* lang=de
* tagmode=OR
* href=index.php?calendar
* }
*
* OR
*
* {CALENDAR:2,main_page.tmpl,de en, href, tag1, tag2 tag2, tag3}
* [item count,[template[,language(en de - separated by space)[, href, tags, tag, tag, tag]]]]
*
**/
if(strpos($content['all'], '{CALENDAR:')) {
$GLOBALS['block']['css']['calendar'] = 'calendar.css'; // +kh: including the css file
include(PHPWCMS_TEMPLATE.'inc_script/phpwcmsCalendar.class.php');
$myCal = & new phpwcmsCalendar();
$myCal->parse($content['all']);
}
?>
Code: Select all
<div class="calendar">
<div class="date">
<div style="float:left;"><img src="{SITE}img/cmsimage.php/25x25/524" valign=center /></div>
<div style="margin-left: 35px;"><strong>{STARTDATE:l lang=DE} <br> {STARTDATE:d.m.}</strong><strong class="year">{STARTDATE:Y}</strong></div>
</div>
{SPACER:100x5}
[TITLE]<h3>[HREF]<a href="{HREF}">[/HREF]{TITLE}[HREF]</a>[/HREF]</h3>[/TITLE]
[TEXT]<div class="teaser">{TEXT}</div>[/TEXT]
<!-- [TEXTLONG]<div class="textlong">{TEXTLONG}</div>[/TEXTLONG] -->
{SPACER:100x5}
[PLACE]<p class="place">Ort: {PLACE}</p>[/PLACE]
[IMAGE_CALENDAR]<div class="image_teaser">{IMAGE_CALENDAR}</div>[/IMAGE_CALENDAR]
</div>
Martin
Re: Links im Kalender
Du verwendest eine ältere Version:
tausche
gegen
nun sollten auch die Tags URL und Target vorhanden sein.
Nicht getestet bitte probieren.
Knut
tausche
Code: Select all
$date['calendar_refid'] = intval($date['calendar_refid']);
if($date['calendar_refid'] > 0) {
$href = 'index.php?aid='.$date['calendar_refid'];
} else {
$href = $this->href ? $this->href . '&show_date='.date('Y-m-d', $date['calendar_start_date']).'_'.$date['calendar_id'] : '';
}
$items[$key] = $this->template;
$items[$key] = render_cnt_template($items[$key], 'HREF', $href);
Code: Select all
$url = '';
$target = '';
$href = $this->href ? $this->href . '&show_date='.date('Y-m-d', $date['calendar_start_date']).'_'.$date['calendar_id'] : '';
if(!empty($date['calendar_refid'])) {
$date['calendar_refid'] = get_redirect_link($date['calendar_refid'], ' ', '');
$date['calendar_refid']['link'] = trim($date['calendar_refid']['link']);
$date['calendar_refid']['link'] = trim($date['calendar_refid']['link'], '#');
$target = $date['calendar_refid']['target'];
if(is_intval($date['calendar_refid']['link'])) {
$url = rel_url(array(), array(), 'aid='.$date['calendar_refid']['link']); //'index.php?aid='.$date['calendar_refid']['link'];
} elseif(strpos($date['calendar_refid']['link'], '://') || strpos($date['calendar_refid']['link'], '?') || strpos($date['calendar_refid']['link'], '.')) {
$url = $date['calendar_refid']['link'];
} elseif(!empty($date['calendar_refid']['link'])) {
$url = rel_url(array(), array(), $date['calendar_refid']['link']);
}
}
$items[$key] = $this->template;
$items[$key] = render_cnt_template($items[$key], 'HREF', $href);
$items[$key] = render_cnt_template($items[$key], 'URL', $url);
$items[$key] = render_cnt_template($items[$key], 'TARGET', $target);
Nicht getestet bitte probieren.
Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
-
- Posts: 18
- Joined: Mon 26. Jan 2009, 22:17
Re: Links im Kalender
Hallo zusammen,
für mich funktioniert mittlerweile eigentlich alles, was ich haben will. Daher keine großen Basteleien.
Ich wollte mit meinem Beitrag eigentlich dem Thread-Ersteller helfen, vielleicht sollte sich der nochmal zu Wort melden.
Aber: bei mr funktionieren in den html-Templates keine <?php?> oder {SITE} RTs, was kann das sein?
Genau geht es um
oder auch
was nicht funktioniert. Was ist da faul? Prinzipiell geht es darum, ein normales Bild zu bekommen, ohne Kalender-Bezug.
Grüsse, Martin
für mich funktioniert mittlerweile eigentlich alles, was ich haben will. Daher keine großen Basteleien.
Ich wollte mit meinem Beitrag eigentlich dem Thread-Ersteller helfen, vielleicht sollte sich der nochmal zu Wort melden.
Aber: bei mr funktionieren in den html-Templates keine <?php?> oder {SITE} RTs, was kann das sein?
Genau geht es um
Code: Select all
<img src="{SITE}img/cmsimage.php/25x25/524" />
Code: Select all
<img src="<?=PHPWCMS_URL ?>img/cmsimage.php/25x25/524" />
Grüsse, Martin
Re: Links im Kalender
{Site} ist normalerweise nicht notwendig. Ich habe allerdings keine Ahnung, weshalb der SITE Tag nicht funktioniert.
direkt nach:
einfügen:
<?= .......... ?> geht grundsätzlich nicht in phpwcms.
[PHP].........[/PHP] damit noch ein Rest Sicherheit vorhanden ist.
Knut
direkt nach:
Code: Select all
$items[$key] = render_cnt_date($items[$key], $date['calendar_start_date'], $date['calendar_start_date'], $date['calendar_end_date']);
Code: Select all
$items[$key] = render_cnt_template($items[$key], 'SITE', PHPWCMS_URL);
<?= .......... ?> geht grundsätzlich nicht in phpwcms.
[PHP].........[/PHP] damit noch ein Rest Sicherheit vorhanden ist.
Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
-
- Posts: 18
- Joined: Mon 26. Jan 2009, 22:17
Re: Links im Kalender
Servus nochmal,
Danke Flip-Flop, das hats gebracht. Jetzt funktioniert der {SITE}-Tag wie erwartet.
Danke,
Martin
Danke Flip-Flop, das hats gebracht. Jetzt funktioniert der {SITE}-Tag wie erwartet.
Danke,
Martin