Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#613 2008-08-18 21:39:25

pepebe
Member
From: Mannheim, Germany
Registered: 2005-02-07
Posts: 74

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

@Alex007,

I’m not really sure what you want to do. Do you want to open links in a new window (target=”_blank”) or a certain frame adn add a date to the url of a calendar item? If this is the case you just have to add a few lines to zem_event.php and taghandlers.php (be sensitive about future updates of textpattern)

Add the following lines to function zem_event_permlink () im zem_event.php

$latts = lAtts(array(
...
'target' => '', //add!
'include_date' => '0', //add!
...

And then hand it over to

function zem_data_field () in zem_event.php by adding the same lines

extract($lAtts(array(
...
'target' => '',
'include_date' => '0',
...

Also, exchange if($type==‘permlink’){…}

With

if ($type 'permlink') { @ @ if ($include_date"1") {
$include_date = zem_event_date(zem_event_thisevent());
}
$out = permlink(array('class'=>$class, 'target'=>$target,'id'=>$out, 'include_date'=>$include_date),$linktext);
}

Finally find function permlink () in taghandlers.php (Note: Before you do anything to this one, please backup taghandlers.php)

For convenience sake completely exchange the following lines with function permlink

function permlink($atts, $thing = NULL)
{
global $thisarticle;

extract(lAtts(array(
'class' => '',
'id' => '',
'style' => '',
'title' => '',
'target' => '', //new
'include_date' =>'', //new
), $atts));

if (!$id)
{
assert_article();
}

$url = ($id) ? permlinkurl_id($id) : permlinkurl($thisarticle);

if ($url)
{
if ($thing === NULL)
{
return $url;
}
if (empty($include_date)){ //new
$date=""; //new
} //new
else $date = '&date='.$include_date; //new

return tag(parse($thing), 'a', ' rel="bookmark" href="'.$url.$date.'"'. //new
($title ? ' title="'.$title.'"' : '').
($style ? ' style="'.$style.'"' : '').
($class ? ' class="'.$class.'"' : '').
($target ? ' target="'.$target.'"' : '') //new
);
}
}

Ok; that’s it. Now you can add the date of an events to a dates’s permlink and also the target attribute to the link itself.

Go to zem_event_cal_entry and add some attributes to the permlink tag:

Example:

<txp:zem_event_permlink wraptag="" include_date="1" target="_blank" >
<txp:zem_event_name label="" wraptag="" />
</txp:zem_event_permlink>

Good luck,

pepebe

P.S. If have included these lines into my pimped zem_event. As soon as I get a “go ahead” from squaredeye I will fnd a way to officially post the complete changes.

P.P.S. Is there anyone out there that can tell me how to use the damned “@” to mark code. I just don’t get it why they sometimes work and sometimes completely mess up…

Last edited by pepebe (2008-08-18 21:44:15)

Offline

#614 2008-08-18 22:11:13

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

Hi pepebe,

I’ve been “following” (just a “superficial” following, haven’t read in detail) of this thread since you started to post about your interest (thanks!) in this plug-in.
I know I should re-read a little all your posts (and those of users you have helped), but could you please do some listing/summary about your plans, and what you have already done? :)

I’m curious and excited about the rebirth of zem_event… _reborn.

About posting code on the forum:
http://textpattern.com/faq/43/how-do-i-post-tags-and-code-on-the-forum

BTW, there is a little issue between zem_event and MLP (event categories aren’t displayed on the “Event” fieldset on the Write tab), but I will also report it on MLP thread, because I think the problem is fault of MLP.

Thanks again!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#615 2008-08-18 23:42:31

typeshige
Member
From: USA
Registered: 2005-08-11
Posts: 151
Website

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

I guess < txp:if_first_article > can’t be made to work with zem_event tags? I’m trying to get this to work from inside the form, zem_event_display, but it seems to be ignored.

Or is there another work around to do something only at with the first event?

Thanks,
Shige

Offline

#616 2008-08-19 17:19:13

Alex007
Member
Registered: 2007-10-24
Posts: 57

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

Hey pepebe

Thanks a lot for your reply regarding the target and time it was kinda what i was after i guess my initial message wasnt that clear but it was all good as it gave me more of an insight into txp!

I did do what you suggested and it worked well except for the date adding to the url it was outputting the span as part of the url but thats not a problem as im not really needing this – what it was i want to do is the following:

Sometimes the zem_event_url and zem_event_location_url added to an article could be an external link which would ideally open a new window. So i was thinking maybe the best way to do this would be to add the following attributes class=“external” and rel=“external” to the <a href>Map URL</a> and then let the JS do its work.

I thought i could do a check to see if the domain was mine or a relative path i.e /calendar/article or a different URL, this way i could then add the class=“external” and rel=“external” to the href if it wasnt my domain.

Any ideas where in txp_event i would have to add this? or have you ever needed this type of functionality before as i am sure it could be really useful.

Thanks again
A.

Offline

#617 2008-08-19 21:48:03

pepebe
Member
From: Mannheim, Germany
Registered: 2005-02-07
Posts: 74

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

Sorry about the span. You have to apply some changes to “function zem_event_date”. By default it will use wraptag=“span” and you don’t need that. Also, it will give out the wrong date format (“x”). Try this instead and don’t forget to add wraptag and format if you want to use zem_event_date (Example: <txp:zem_event_date format=”%x” wraptag=“span” />

function zem_event_date($atts) {
$latts = lAtts(array(
'type' => 'date',
'field' => 'event_date',
'format' => '%Y-%m-%d', // former default was %x
'wraptag' => '', // former default was span
'class' => __FUNCTION__,
),$atts, 0);

return zem_data_field(zem_event_thisevent(), $latts + $atts);
}

I changed those setting ages ago (a least a week…) and completely forgot about it. Sorry,really.

Regarding external links. Of course this would be a very useful feature. Even though Í think this Topic should be moved to another part of the forum here are a few things to think about:

CSS
There is a CSS trick that works in safari and mozilla/firefox. (This is sizzling hot stuff, so don’t expect IE to support it in the next years…) Read here.

Java Script
While java script would not be a problem on the admin side, I don’t think we should use java sript to solve this problem:
- First of all I wouldn’t entrust that problem to the hope that visitors have java script enabled (I, for one, usually disable java script and I know some very large companies that disable java script by default).
- Also, java script will slow down a large page considerably and
- Finally my java script skill are less than moderate. I couldn’t contribute to that endeavour. ;)

Textpattern / PHP
I think it would be better to solve this problem within txtpattern. Though it should be fairly easy in some areas, it could become surprisingly tricky in others. Of course it would be easy to check if the domainname appears within a url. Also I think permlinks should always be internal links. But how about links within articles or excerpts? We could parse them for any url and check them for external/internal targets. Interesting idea. I have to ponder about those things a bit. Please be patient.

So that’s it for tonight.

Bye,

pepebe

Last edited by pepebe (2008-08-19 22:01:54)

Offline

#618 2008-08-19 23:44:06

typeshige
Member
From: USA
Registered: 2005-08-11
Posts: 151
Website

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

I fixed it by adding some small changes starting at line 705:

$out = array();
global $thisarticle;
$count=0;
while ($row = nextRow($rs)) {
++$count;
article_push();
$zem_thiseventcal = $row;
populateArticleData($row);
$thisarticle['is_first'] = ($count == 1);

$thisarticle['is_last'] = ($count == numRows($rs));
$out[] = parse($thing);
$zem_thiseventcal = NULL;
article_pop();
}

typeshige wrote:

I guess < txp:if_first_article > can’t be made to work with zem_event tags? I’m trying to get this to work from inside the form, zem_event_display, but it seems to be ignored.

Or is there another work around to do something only at with the first event?

Thanks,
Shige

Last edited by typeshige (2008-08-19 23:44:44)

Offline

#619 2008-08-20 07:40:48

TomBus
Member
From: Bavaria
Registered: 2005-07-06
Posts: 85

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

Hi pepebe,
Thank you for Your the assessment of the problem. A connection with a database management program would not be bad. Is there anything?
tombus

Offline

#620 2008-08-20 13:52:10

Brun
New Member
From: Ukraine
Registered: 2008-08-19
Posts: 8
Website

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

When I install plugins (zem_event and zem_paginate), on a site rotined such error

<txp:zem_event_mini_calendar class=“minical” class_event=“full” class_empty=“empty” section=“zem_event_list” /> -> Textpattern Warning: Unknown column ‘textpattern.ID’ in ‘where clause’
select zem_event_date.* from zem_event_calendar, zem_event_date, l10n_txp_uk_ua where zem_event_calendar.id=zem_event_date.event_id and zem_event_calendar.article_id = textpattern.ID and textpattern.Status >= 4 and textpattern.Posted <= now()
textpattern/lib/txplib_db.php:251 getRows() on line 117

textpattern/lib/txplib_db.php:117 trigger_error()
textpattern/lib/txplib_db.php:315 safe_query()
textpattern/lib/txplib_db.php:251 getRows()
textpattern/lib/txplib_misc.php(574) : eval()’d code:1005 safe_rows()
textpattern/publish.php:970 zem_event_mini_calendar()
processTags()
textpattern/publish.php:929 preg_replace_callback()
textpattern/publish.php:466 parse()
index.php:40 textpattern()

Textpattern version 4.0.6, zem_event 0.3.5 and zem_paginate 0.1.
Can add only a category. Events in general not evidently. That do I do not so?

Offline

#621 2008-08-20 15:13:58

pepebe
Member
From: Mannheim, Germany
Registered: 2005-02-07
Posts: 74

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

Hi Brun, do you have MLP plugin installed, I tried it yesterday ad it caused the same error.

If you need zem_event, uninstall the MLP (There is a tab to remove the tables). Remove the plugin’s php files from tetpattern/lib and copy a new txplib_db.php into your lib directory. This should remove the problem.

If you need MLP, you have to remove zem_event until I or somebody else have found out how to run both plugins at once…

Good Luck,

pepebe

Offline

#622 2008-08-20 15:15:33

pepebe
Member
From: Mannheim, Germany
Registered: 2005-02-07
Posts: 74

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

TomBus wrote:

Hi pepebe,
Thank you for Your the assessment of the problem. A connection with a database management program would not be bad. Is there anything?
tombus

Databae management program? I don’t understand. Please give mor details and/or an example.

CU,

pepebe

Offline

#623 2008-08-20 15:36:15

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

Hi pepebe,

Yesterday, I’ve reported a little issue between MLP and zem_event.
Then, Graeme (a great developer involved in some great plugins as MLP and permlinks) posted on the thread telling he have fixed it.

Not sure if this is related at all with the issue reported above by Brun.
I haven’t tried exhaustively this MLP + zem_event combination. For example, I haven’t tried the calendar/minicalendar zem_event tags, because I don’t needed (and I don’t like) calendars at all.

BTW, may you have missed my other post directed to you? :D


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#624 2008-08-20 20:10:58

typeshige
Member
From: USA
Registered: 2005-08-11
Posts: 151
Website

Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]

I’m still learing all the features of this plugin and I was wondering if there is a conditional that tells you if the current article is an event?

If not, is there an easy way to detect it?

Offline

Board footer

Powered by FluxBB