Jevents 2.x (Free Access)

Completely modify output jevents_latest, template override  Topic is solved

Discuss JEvents 2.x for Joomla 1.5-2.5 here - club members can use the special club forum for faster response times.
Forum rules
When requesting support please follow these steps:

1. Update all JEvents add on's first, via the Joomla! Updater
2. Copy and Paste the JEvents Support Information from the JEvents Control Panel.
3. If you get a 500 error OR white page, enable Maximum Error Reporting in Joomla! Global Config and visit the page again, this should give you a more detailed error and help us provide a prompt response.

Postby ttetzloff » Wed May 09, 2012 8:49 pm

Hello everyone!,

I have a question for you guys. I am using jevents with the mod_jevents_latest module. However I have run in to a bit of a stumbling block. I have using a template override with the alternative template. What I would like to do is be able to ignore the Custom Format Strings for the module and component and instead manually write out the for each statement in mytemplate/html/mod_jevents_latest/alternative/latest.php

Here is the code section I am talking about:

Code: Select all
      $content .= '<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">';

      if(isset($this->eventsByRelDay) && count($this->eventsByRelDay)){

         // Now to display these events, we just start at the smallest index of the $this->eventsByRelDay array
         // and work our way up.

         $firstTime=true;

         // initialize name of com_jevents module and task defined to view
         // event detail.  Note that these could change in future com_event
         // component revisions!!  Note that the '$this->itemId' can be left out in
         // the link parameters for event details below since the event.php
         // component handler will fetch its own id from the db menu table
         // anyways as far as I understand it.

         $task_events = 'icalrepeat.detail';

         $this->processFormatString();

         foreach($this->eventsByRelDay as $relDay => $daysEvents){

            reset($daysEvents);

            // get all of the events for this day
            foreach($daysEvents as $dayEvent){

               $dst = "border-color:".$dayEvent->bgcolor();
               if($firstTime) $content .= '<tr><td style="'.$dst.'">';
               else $content .= '<tr><td style="'.$dst.'">';

               // generate output according custom string
               foreach($this->splitCustomFormat as $condtoken) {

                  if (isset($condtoken['cond'])) {
                     if ( $condtoken['cond'] == 'a'  && !$dayEvent->alldayevent()) continue;
                     else if ( $condtoken['cond'] == '!a' &&  $dayEvent->alldayevent()) continue;
                     else if ( $condtoken['cond'] == 'e'  && !($dayEvent->noendtime() || $dayEvent->alldayevent())) continue;
                     else if ( $condtoken['cond'] == '!e' &&  ($dayEvent->noendtime() || $dayEvent->alldayevent())) continue;                     
                     else if ( $condtoken['cond'] == '!m' &&  $dayEvent->getUnixStartDate()!=$dayEvent->getUnixEndDate() ) continue;
                     else if ( $condtoken['cond'] == 'm' &&  $dayEvent->getUnixStartDate()==$dayEvent->getUnixEndDate() ) continue;
                  }
                  foreach($condtoken['data'] as $token) {
                     unset($match);
                     unset($dateParm);
                     $match='';
                     $dateParm="";
                     if (is_array($token)) {
                        $match = $token['keyword'];
                        $dateParm = isset($token['dateParm']) ? trim($token['dateParm']) : "";
                     }
                     else if (strpos($token,'${')!==false){
                        $match = $token;
                     }
                     else {
                        $content .= $token;
                        continue;
                     }

                     $this->processMatch($content, $match, $dayEvent, $dateParm, $relDay);

                     } // end of foreach
               } // end of foreach
               $content .= "</td></tr>\n";
               $firstTime=false;
            } // end of foreach
         } // end of foreach

      } else {
         $content .= '<tr><td class="mod_events_latest_noevents">'. JText::_('JEV_NO_EVENTS') . '</td></tr>' . "\n";
      }
      $content .="</table>\n";


I am looking at the foreach loop in the center section. Correct me if I am wrong, but I believe that the following line actually is what matches the events to the modules selection criteria and outputs it to the screen:

Code: Select all
$this->processMatch($content, $match, $dayEvent, $dateParm, $relDay);


However, what I would like to do is to be able to manually input or "hard code" the custom strings and my designs table structure in latest.php template override rather than in the custom string module textarea.

The reason I can not use the custom string box on the module is that it adds new lines to every bit of code distorting the layout I am creating for the jevents_latest module. Being able to structure this in the latest.php file would allow me greater control for this layout.

Any ideas? If I am not clear let me know and I will attempt to describe this in greater detail.

Thanks,
-Tyler
ttetzloff
 
Posts: 24
Joined: Wed May 09, 2012 8:36 pm

Postby Geraint » Thu May 10, 2012 11:39 am

New lines in the output are probably from new lines in your custom format string.

You could look at the code of the processMatch method (in the default layout file) and even do an override of this method if you want
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!
User avatar
Geraint
 
Posts: 42781
Joined: Fri Feb 15, 2008 6:14 pm

Postby ttetzloff » Tue May 15, 2012 2:10 pm

Geriant,

Thank you for the reply. I will certanely give that a try. I just thought of something though. Is there a way to supress the addition of the
Code: Select all
<br />
on new lines in the custom format string field? This would actually resolve my issue and I would be able to style this module in the way I need to.

-Tyler
ttetzloff
 
Posts: 24
Joined: Wed May 09, 2012 8:36 pm

Postby Geraint » Tue May 15, 2012 2:37 pm

Geraint wrote:New lines in the output are probably from new lines in your custom format string.
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!
User avatar
Geraint
 
Posts: 42781
Joined: Fri Feb 15, 2008 6:14 pm

Postby ttetzloff » Tue May 15, 2012 3:24 pm

Geriant,

Thanks again for the reply. Here is the situation:

When I have the custom format string like this:

Code: Select all
${eventDate}${title}
${extraInfo}


I get the following code output:

Code: Select all
<table class="mod_events_latest_table" width="100%" border="0" cellspacing="0" cellpadding="0" align="center"><tr class="jevrow0"><td class="mod_events_latest_first"><span class="mod_events_latest_date">Thu May 24 @08:00</span><span class="mod_events_latest_content"><a href="/index.php?option=com_jevents&amp;task=icalrepeat.detail&amp;evid=34&amp;Itemid=111&amp;year=2012&amp;month=05&amp;day=24&amp;title=test-indyup-event&amp;uid=3b2575cf94bb3bb245398cb3e8a38876&amp;catids=15|16" >Test IndyUp Event</a></span><br />

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. </td></tr>
<tr class="jevrow1"><td class="mod_events_latest"><span class="mod_events_latest_date">Thu Jun 21 @08:00</span><span class="mod_events_latest_content"><a href="/index.php?option=com_jevents&amp;task=icalrepeat.detail&amp;evid=35&amp;Itemid=111&amp;year=2012&amp;month=06&amp;day=21&amp;title=user-group-meetup&amp;uid=2cfcd9a1e4c98663e0d1ea29b80d0df5&amp;catids=15|16" >User Group Meetup</a></span><br />

Morbi interdum mollis sapien. Sed ac risus. Phasellus lacinia, magna a ullamcorper laoreet, lectus arcu pulvinar risus</td></tr>
<tr class="jevrow0"><td class="mod_events_latest"><span class="mod_events_latest_date">Mon Jul 16 @08:00</span><span class="mod_events_latest_content"><a href="/index.php?option=com_jevents&amp;task=icalrepeat.detail&amp;evid=36&amp;Itemid=111&amp;year=2012&amp;month=07&amp;day=16&amp;title=adobe-user-conference&amp;uid=57e1600b51b0b654fc6a08cb6f7b27f2&amp;catids=15|16" >Adobe User Conference</a></span><br />

Suspendisse mauris. Fusce accumsan mollis eros. Pellentesque a diam sit amet mi ullamcorper vehicula.</td></tr>
</table>


Notice the <br /> directly after the </span> tags. What I am trying to find out is if there is a way to prevent jevents from adding the </br> tag if there is a hard return/new line in the custom format string field. If I add an html table to the custom format string field and everything is not on one line in the custom format string field I get a <br /> everywhere there is a new line. Does this make sense?

Thanks again,
-Tyler
ttetzloff
 
Posts: 24
Joined: Wed May 09, 2012 8:36 pm

Postby Geraint » Tue May 15, 2012 3:44 pm

Geraint wrote:
Geraint wrote:New lines in the output are probably from new lines in your custom format string.

i.e. use
Code: Select all
${eventDate}${title}${extraInfo}
without the carriage return
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!
User avatar
Geraint
 
Posts: 42781
Joined: Fri Feb 15, 2008 6:14 pm

Postby ttetzloff » Tue May 15, 2012 3:59 pm

Geraint,

Thank you again for the reply. I understand what you are saying and indeed that does work.

What I was trying to say is, say I wanted to place a html table IN the custom format string field of the module like this:

Code: Select all
<table>
<tr><td>${eventDate}</td></tr>
<tr><td>${title}</td></tr>
<tr><td>${extraInfo}</td></tr>
</table>


When I add code like this to the custom format string field it adds a <br /> to each line like this which makes sense from the information you provided. An example of that is below:

Code: Select all
<table><br />
<tr><td>${eventDate}</td></tr><br />
<tr><td>${title}</td></tr><br />
<tr><td>${extraInfo}</td></tr><br />
</table><br />


If I write the table on one line it will not include the line breaks and works great. Like this:

Code: Select all
<table><tr><td>${eventDate}</td></tr><tr><td>${title}</td></tr><tr><td>${extraInfo}</td></tr></table>


However, I was trying to see if there was a way to stop the new line break creation in the custom format string field. Editing a large table from one line of code can be a pain, but if it isn't possible I understand. I just thought I would ask. I thought this would be a great alternative to creating a new template for the module.

Thanks again,

-Tyler
ttetzloff
 
Posts: 24
Joined: Wed May 09, 2012 8:36 pm

Postby Tonyp » Tue May 15, 2012 6:37 pm

Hello,

This is simple, just un-neaten your code i.e.:

Code: Select all
<table><tr><td>${eventDate}</td></tr><tr><td>${title}</td></tr><tr><td>${extraInfo}</td></tr></table>


As when your do a carriage return the editor automatically adds a <br/>
---------------------------------------
Feel free to PM me if you would like Custom Installs or Joomla! related work for a competitive quote.

User avatar
Tonyp
Team Staff
 
Posts: 23633
Joined: Tue Oct 12, 2010 9:12 pm
Location: Isle of Man

Postby ttetzloff » Tue May 15, 2012 7:27 pm

Tony,

Thanks for the reply. I have done that and it works great. I was just trying to see if it was possible to accomplish this without "unneating" the code. Not a big deal, but thought I would ask.

-Tyler
ttetzloff
 
Posts: 24
Joined: Wed May 09, 2012 8:36 pm


Return to Jevents 2.x (Free Access)

  • Who is online
  • View new posts
  • View unanswered posts
  • In total there are 0 users online :: 0 registered and 0 hidden (based on users active over the past 5 minutes)
  • Most users ever online was 94 on Tue Sep 01, 2009 12:33 am
  • Users browsing this forum: No registered users