- Posts: 23
- Thank you received: 0
Latest Sermons - Popup Player
- James Cooper
- Topic Author
- Offline
- Junior Member
Less
More
11 Jan 2014 21:01 #4265
by James Cooper
Latest Sermons - Popup Player was created by James Cooper
In the latest sermons module it would be cool if, when clicking on the link, it would open the popup player instead of taking you to another page where the sermon is played. I'm not sure if this is already possible but, I tried everything I could think of to get it working.
Please Log in or Create an account to join the conversation.
- Thomas Hunziker
- Offline
- Administrator
11 Jan 2014 22:21 - 11 Jan 2014 22:22 #4266
by Thomas Hunziker
Replied by Thomas Hunziker on topic Latest Sermons - Popup Player
You could do that by overriding the module output in your template. And then append "&tmpl=component&layout=popup" to the link and set it to open in a new window.
You can read more about overrides here: docs.joomla.org/Layout_Overrides_in_Joomla and docs.joomla.org/How_to_override_the_outp...rom_the_Joomla!_core
You can read more about overrides here: docs.joomla.org/Layout_Overrides_in_Joomla and docs.joomla.org/How_to_override_the_outp...rom_the_Joomla!_core
Last edit: 11 Jan 2014 22:22 by Thomas Hunziker.
Please Log in or Create an account to join the conversation.
- James Cooper
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 23
- Thank you received: 0
12 Jan 2014 19:40 #4268
by James Cooper
Replied by James Cooper on topic Latest Sermons - Popup Player
Thank you! I was able to get the pop up working on my local PC by changing your code in modules\mod_latestsermons\tmpl\default.php from this:
$link = JRoute::_('index.php?option=com_sermonspeaker&view=sermon&id='.$row->slug.'&Itemid='.$itemid);
to this:
$link = "popup=window.open('index.php/sermons/sermon/".$row->id."?layout=popup&tmpl=component')";
and then I added the $link to the onclick event of the href tag.
The only issue I'm running into is when I push this to my site it no longer works because the URL doesn't need the index.php appended to it. Is there a Joomla or PHP function I need to add so it knows when the URL does and doesn't need in the index.php appended? I know your popup created in the Sermons Listing works like this when the popup player is enabled.
$link = JRoute::_('index.php?option=com_sermonspeaker&view=sermon&id='.$row->slug.'&Itemid='.$itemid);
to this:
$link = "popup=window.open('index.php/sermons/sermon/".$row->id."?layout=popup&tmpl=component')";
and then I added the $link to the onclick event of the href tag.
The only issue I'm running into is when I push this to my site it no longer works because the URL doesn't need the index.php appended to it. Is there a Joomla or PHP function I need to add so it knows when the URL does and doesn't need in the index.php appended? I know your popup created in the Sermons Listing works like this when the popup player is enabled.
Please Log in or Create an account to join the conversation.
- Thomas Hunziker
- Offline
- Administrator
12 Jan 2014 19:59 #4270
by Thomas Hunziker
Replied by Thomas Hunziker on topic Latest Sermons - Popup Player
Yeah, it's called JRoute::_();
Do this instead:
And instead of directly changing the file /modules/mod_latestsermons/tmpl/default.php, copy it to /templates/your_template/html/mod_latestsermons/default.php and adjust it there. This way an update to the module will not overwrite your changes
Do this instead:
Code:
$link = JRoute::_('index.php?option=com_sermonspeaker&view=sermon&tmpl=component&layout=popup&id='.$row->slug.'&Itemid='.$itemid);
And instead of directly changing the file /modules/mod_latestsermons/tmpl/default.php, copy it to /templates/your_template/html/mod_latestsermons/default.php and adjust it there. This way an update to the module will not overwrite your changes
Please Log in or Create an account to join the conversation.
- James Cooper
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 23
- Thank you received: 0
13 Jan 2014 17:03 #4271
by James Cooper
I did what you said and my code looks like this:
When I click the link it doesn't take you to the popup player. You can see this on our homepage in the test region here - when you click one of the links under "Weekly Sermons". Keep in mind the audio files aren't really there but, the popup player should come up if it works correctly and just say, "File not Found". I think...
Replied by James Cooper on topic Latest Sermons - Popup Player
Thomas Hunziker wrote: Yeah, it's called JRoute::_();
Do this instead:Code:$link = JRoute::_('index.php?option=com_sermonspeaker&view=sermon&tmpl=component&layout=popup&id='.$row->slug.'&Itemid='.$itemid);
And instead of directly changing the file /modules/mod_latestsermons/tmpl/default.php, copy it to /templates/your_template/html/mod_latestsermons/default.php and adjust it there. This way an update to the module will not overwrite your changes
I did what you said and my code looks like this:
Code:
$link = JRoute::_('index.php?option=com_sermonspeaker&view=sermon&tmpl=component&layout=popup&id='.$row->slug.'&Itemid='.$itemid);
<a href="#" onclick="<?php echo $link; ?>">
When I click the link it doesn't take you to the popup player. You can see this on our homepage in the test region here - when you click one of the links under "Weekly Sermons". Keep in mind the audio files aren't really there but, the popup player should come up if it works correctly and just say, "File not Found". I think...
Please Log in or Create an account to join the conversation.
- Thomas Hunziker
- Offline
- Administrator
13 Jan 2014 17:14 #4272
by Thomas Hunziker
Replied by Thomas Hunziker on topic Latest Sermons - Popup Player
Sorry, missed the 'popup=window.open' part.
That should work I think.
Code:
$link = JRoute::_('index.php?option=com_sermonspeaker&view=sermon&tmpl=component&layout=popup&id='.$row->slug.'&Itemid='.$itemid);
<a href="#" onclick="popup=window.open('<?php echo $link; ?>')">
That should work I think.
The following user(s) said Thank You: James Cooper
Please Log in or Create an account to join the conversation.
Time to create page: 0.102 seconds