Page 1 of 1

[Solved] Calendar Help: Assign detailpage within a calendar template?

Posted: Mon Jan 12, 2009 11:38 pm
by SINphul
Hello.  I have what most would probably consider an odd question, but here it goes:

I have a need to assign the "detailpage" parameter from within a calendar template rather than from the module call smarty tag.  Is this possible?

I realize that sounds silly considering you can just do it via the smarty tag call, but in my situation (long story), there is no call and therefore is just going to the defaulted calendar template once {$event.url} is clicked.  As there is no smarty call, the module is not allowing me to choose what page that calendar data shows on.  So, in short, I need to be able to assign the "detailpage" parameter from within this defaulted template to route the calendar data to the page of my choosing.

Thanks in advance for any help you guys can provide!

Re: Calendar Help: Assign detailpage within a calendar template?

Posted: Mon Jan 12, 2009 11:45 pm
by JeremyBASS
>>>I have a need to assign the "detailpage" parameter from within a calendar template rather than from the module call smarty tag.  Is this possible?

I don't full understand what you are looking for...

>>>calendar data to the page of my choosing

yes you can... I can't go in to it right now but I can come back later if noone else is able to help...

cheers
jeremyBass

Re: Calendar Help: Assign detailpage within a calendar template?

Posted: Mon Jan 12, 2009 11:59 pm
by SINphul
Hi Jeremy; thanks for the reply.  I'll try to explain as best I can...

I realize that when you declare an instance of the calendar module on your site with a specific detailpage, you would do something like the following:

Code: Select all

{cms_module module="Calendar" display="upcominglist" upcominglisttemplate="summary" reverse="true" detailpage="83"}
However, in my situation, I don't have the luxury of applying the detailpage parameter to the calendar smarty tag, since there is no smarty tag to apply it in.  Therefore, the only other place I could think to assign the detailpage parameter was within the calendar template itself, though I have no idea how.  I could provide you the reason why I have no smarty tag to assign the parameter to, but honestly I think it will just confuse everyone more :)  So is it a possibility to assign the detailpage (be it an alias or page id) from within a calendar template?

Re: Calendar Help: Assign detailpage within a calendar template?

Posted: Tue Jan 13, 2009 12:57 am
by JeremyBASS
I only wish... ;) on that tag... I'm still not fully sure on what you are wanting..

now if your in the upcominglist then you need to go to setting in the admin side and choose the page
Default page that contains Calendar. This page must contain a Smarty tag that calls Calendar. Required if you use the pretty URLs.:

if what you are wanting to do is to click from one calendar call where you are on the same page (two cals) or one on to different pages.. then you want to do this...

where 57 s the page id

for the calendar_Sample tempalte

Code: Select all

/*AT top*/
{assign var=actionIDs value=$actionid}




/*Put in it's place*/
{$actionID}
 {assign var=dayUrl value=$day.url|replace:$actionIDs:'m9'|regex_replace:'/returnid=([0-9][0-9]|[0-9][0-9][0-9])+/':'returnid=57'}


{$dayurl}
Now m9 in the order that the center receiving calendar is locate... so 57 is the page and m9 is the location on the page where the action was done. So replace those examples...

if you need to find the action id just place {get_template_vars} in the receiving calendar. it'll list it out as actionid=""

Hope this helps... Cheers
jeremyBass

Re: Calendar Help: Assign detailpage within a calendar template?

Posted: Tue Jan 13, 2009 2:22 am
by SINphul
Jeremy, thanks again for the assistance, but the code provided doesn't seem to be doing the trick (or perhaps I'm not implementing it properly).  I'll go ahead and give you the long story now, lol.

Basically, I'm creating a calendar page on my website that contains two calendar module calls: one upcoming list on the left, and a simplified calendar table on the right.  You can see it here: http://www.hbcpkreg.com/events-calendar/

Now the calendar upcoming list on the left works exactly as I want it to.  It organizes events by month and the {$event.url} takes them to the exact detailpage I specify in my smarty tag (in this case, page id 83).

The calendar table on the right however does not function as I want it to.  How I envision it is the user clicks on one of the highlighted dates (indicating an event is occurring on that date), which takes them to a list of events for that specific day within the same page (so no detailpage is set in this smarty tag).  This list of events is set to display on the left side of the page, leaving the mini-calendar on the right of the page for the user to access if they want to change dates.  This is all well and good, but my problem is that I cannot set the detailpage parameter on this secondary list, as there is no accompanying smarty tag for it.  It is just auto generated by my right-hand calendar to the page.  Therefore, any {$event.url} links I have displaying on that list will just open the data in the same page, and not page id 83, as I wish to have it...

Whew...does that make sense?  You can probably get and idea of what I mean when you look at the actual site.  Again, any help would be appreciated.  Thanks so much!

Re: Calendar Help: Assign detailpage within a calendar template?

Posted: Tue Jan 13, 2009 3:08 am
by JeremyBASS
Still sounds to me like the code laid out is what will do what you need... you do have to change the action id  or 'm9' to what your action id of the calendar is...

check this set up and see if any of that is close to what you are talking about...
http://www.calamshriners.com/Calendar/

Cheers
jeremyBass

Re: Calendar Help: Assign detailpage within a calendar template?

Posted: Wed Jan 14, 2009 4:41 am
by SINphul
Jeremy, I see how it works now, and I think I'm really really close :)  I tested your code tonight on my "calendar template" for the calendar module, and it allowed me to set the detailpage directly from within the template, which is exactly what I want.  But the thing is, I want this functionality from within one of my "list templates" for the calendar module.  And when I apply your same code to my "list template" (and changing out the $day.url variable for $event.url), it doesn't seem to work there.  Here's the code I'm using with your additions:

Code: Select all

{assign var=actionIDs value=$actionid}

<h3>Browse Events</h3>

{*Sets variable prevMonth equal to zero*}
{assign var="prevMonth" value="0"}

<div id="collapseMenu">

{foreach from=$events key=key item=event}

{$actionID}
{assign var=eventUrl value=$event.url|replace:$actionIDs:'cntnt01'|regex_replace:'/returnid=([0-9][0-9]|[0-9][0-9][0-9])+/':'returnid=83'}

{*If prevMonth isn't equal to current entry month then start new month area*}
{if $prevMonth != $event.event_date_start|date_format:"%m"}
{*If this isn't the first run-through then also close the last content area*}
{if $prevMonth != "0"}
</div></div>
{/if}
<div class="collapseBox">
<h4 class="defaultOpen"><a href="#"><em>{$event.event_date_start|date_format:"%B %e, %Y"}</em></a></h4>
<div>
{/if}

<dl>
<dt>
	{$event.event_date_start|date_format:"<small>%b</small> %e"}
</dt>
<dd>
	<a href="{$eventUrl}">{$event.event_title}</a>
</dd>
<dd>
{if $event.event_summary != ""}
	{$event.event_summary}
{elseif $event.event_details != ""}
	{$event.event_details}
{/if}
</dd>
</dl>

{assign var="prevMonth" value=$event.event_date_start|date_format:"%m"}

{/foreach}

</div>

</div>

</div>
Since it works for the "calendar template" I know we're really close.  Do you know how I'd adjust your code to use it in a "list template" instead?  Your continued help is greatly appreciated!  Thanks for any further assistance!

Re: Calendar Help: Assign detailpage within a calendar template?

Posted: Wed Jan 14, 2009 5:24 am
by calguy1000
See the CGSimpleSmarty module, and the {module_action_link} tag it contains.
Using that tag within your calendar template you can create a link to whatever module action you want, with whatever parameters you want.

Try something like:
{module_action_link module='Calendar' action='default' display='event' detailpage='blah' event_id=$event.event_id}

Re: Calendar Help: Assign detailpage within a calendar template?

Posted: Thu Jan 15, 2009 1:40 am
by SINphul
Hi calguy; thanks so much for the suggestion.  Unfortunately, the module and tag don't seem to do the trick either.  The variable within the URL that is being generated seems to be "returnid" and it seems to inherit it from the previous template regardless of what I set in that module tag (I tried your suggested pagedetail, and I also plugged in returnid to see what it'd do, but to no avail).

I'm starting to think it may not be possible to override the inheritance of the pagedetail from within a nested template.  Any other potential ideas would be appreciated though.  Thanks again for the assistance.

Re: Calendar Help: Assign detailpage within a calendar template?

Posted: Thu Jan 15, 2009 2:24 am
by JeremyBASS
:) I promise what I told you will, in pratice, work but adjusting it may be needed... I'm investigating calguys suggesting, but for now I'm still going to keep doing it the same way...

Now because for me I know this works trick works... the question is what is not working... what did you do, is it in the site now... I'm 99% sure I know what you want...

the one thing I see wrong  from what I laid out to what you have is you , thou it's the right place, change the value incorrectly....

mine

{assign var=dayUrl value=$day.url|replace:$actionIDs:'m9'|regex_replace:'/returnid=([0-9][0-9]|[0-9][0-9][0-9])+/':'returnid=57'}

yours

{assign var=eventUrl value=$event.url|replace:$actionIDs:'cntnt01'|regex_replace:'/returnid=([0-9][0-9]|[0-9][0-9][0-9])+/':'returnid=83'}

cntnt01 is not going to work... that’s for the admin side *pretty sure on that*... what was suppose to end up there was a m#.... so m5 or m15... that is the actionid ... of where the cal tag is located in the order of the page's construction...

But I think you’ll need to write more like this…

{assign var=dayUrl value=$event.url|regex_replace:'/calendar\/([0-9][0-9]|[0-9][0-9][0-9])+/':'calendar/57'}

and create a new page with the calendar tag that has the detail page pram, and use it's 57... it's "returnid".. you can hide that page from the menu so it doesn't pollute it up..
think if it like this… there is a thrower and catcher… and a tag can only catch so much so your going to add another one to pick up the slack…

BUT... now you may not need to nest... with the principle behind the code I laid out, you could push it to a cal tag that is not nested.. and that tag would have a detail pram in the call...


cheers
jeremyBass

Re: Calendar Help: Assign detailpage within a calendar template?

Posted: Fri Jan 16, 2009 11:22 pm
by SINphul
;D That did it Jeremy!  Thanks so much; the template now receives it's pagedetail information from the new variable assignment you show above.

I hate to ask you another calendar-related question, as I've already monopolized enough of your time, but if I haven't bugged you enough already, I have one offshoot question.  Assuming you visit the calendar page on my site (using the URL above), you're presented with the option to browse by month on the left or by calendar view on the right.  When you use the right calendar and click on an event day, it populates the left side with only the events of that particular day.

This all functions just as I would like, but after the left side is populated, should the user attempt to go back to using the calendar view on the right by clicking either the next or previous month buttons, the module spits out an error like the following:

Code: Select all

Warning: Parameter year is not known... dropped in /home/content/h/b/c/hbcpk/html/lib/misc.functions.php on line 1347

Warning: Parameter month is not known... dropped in /home/content/h/b/c/hbcpk/html/lib/misc.functions.php on line 1347
Presumably, this is due to the fact that the year and month variables it is referring to is being provided to the left content area by the right calendar module call (and changing the month causes a sudden loss of those two variables).  You wouldn't happen to know any way to preserve those variables for the left content area until the user has chosen a new event date on the right would you?  Again, I hate to monopolize yours (or other folks) time, but if you know of a viable solution, I'd greatly appreciate any incite.

And thanks again for all your help with the above!

Re: Calendar Help: Assign detailpage within a calendar template?

Posted: Sat Jan 17, 2009 1:24 am
by JeremyBASS
I see... ok... this is due to the fact the calendar is not in the location the link is pointing to which via the actionid... so this is what you want to do...

here is the var for the link: $navigation.next

which outputs

http://www.hbcpkreg.com/index.php?mact= ... 81&page=81

now you have two calendars on the page so you'll want to point the link via the actionid which is m4 now, to the correct calendar. Now you have to make a choice... how deep do you want to go with this... what is the full path of the user... because lets say you use

{assign var=navigationnext value=$navigation.next|replace:';m4':';m#'}

You can leave holes even if it's something a user has to work at to produce.  So plan your user path ahead of time and save your self some work…

The basic idea is this... use {get_tempalte_vars} in the template to see all vars... always examine the output.. this case a link... and then you know how to |replace: |regex_replace: |strip: etc... and a whole bunch of others you can find on the smarty website, to change the output to your liking…

I hope this help… cheers
jeremyBass

Re: Calendar Help: Assign detailpage within a calendar template?

Posted: Sat Jan 17, 2009 1:47 am
by JeremyBASS
one other thing to remember... if you change the location of calendar... mean the location in the list of actionids, you'll need to adjust your reassignments where it’s hard coded... but since you should be able to use

{assign var=actionIDs value=$actionid}
and
$actionID

you should be fine and have few if any hard coded values... I'm still working on trying to read the actionid list globally and using something like this


{capture assign='cal1'}{cms_module module="calendar" etc... }{/capture}
{assign var=inputcategory2 value=$cal1|regex_replace:"/]*>((?!`$actionID`)[^/":"the new link"}
from here
and in the tempalte
{assign var=actionIDs value=$actionid}

to re-assign the value as it goes... etc... or somthing like that... may-be a globe type... not fully sure yet... lol

still in work and then you will just need to place code and be done never worrying that you add a new tag above the cal tag in the action order... I just need the time to be able to write it lol... any ways... hope this all is helpful...

cheers jeremyBass

Re: Calendar Help: Assign detailpage within a calendar template?

Posted: Tue Jan 20, 2009 2:19 am
by SINphul
Jeremy, once again, I can't thank you enough for all the incite into my calendar issues.  I'm going to tinker with those variables for a bit to see if I can get her working, but I'm marking this thread as solve for now (for anyone looking to also mod the detail page settings within a template).  Thanks!  ;D

Re: [Solved] Calendar Help: Assign detailpage within a calendar template?

Posted: Tue Jan 20, 2009 2:45 am
by JeremyBASS
you know now that I think about it...

{assign var=actionIDs value=$actionid}

may be repetitive... I thought there was a reason why... but now it escapes me... you could probably just put $actionid in place of $actionIDs


I'm glad I could help.. it's good karma...

Cheers
jeremyBass