Welcome, Guest
Username Password: Remember me

Itemid challenges
(1 viewing) (1) Guest
When posting bug reports, please include as much detail as possible, including:
- your version of JBS,
- what view you were on,
- what task you were trying to perform,
- any error messages you encountered,
- step by step instructions to reproduce if possible.
If you have worked out a fix, upload the relevant file (renamed to .txt) and we'll update quickly!
  • Page:
  • 1
  • 2

TOPIC: Itemid challenges

Itemid challenges 11 Jun 2010 22:04 #2280

I am testing 6.2 Beta 2 and the Itemid challenge is back. The Itemid is what Joomla uses to decide which modules and templates need to appear on the page and which menu item is selected. This post isn’t about the AVR problems. When you have a menu of Studies List then “Link to 1st Media File” the Itemid is lost so depending on the template the Studies List menu item isn’t highlighted any longer.

The Itemid is also lost when a popup player is used it refreshes the main page and the refreshed main page doesn’t have the Itemid. When the page refreshes the media icon also disappears for that study. If you close the popup then refresh the page the popup opens again.

I am not sure why the main page needs to refresh to open the popup, I thought the popup could open with a simple JavaScript, maybe I am wrong.

Here is the code I used to try the popup.

<form> <input value="New Window!" onclick="mywin=window.open('http://www.mysite.com/components/com_biblestudy/assets/player/player.swf?file=http://www.mysite.com/media/mystudy.mp3&amp;showdigits=true&amp;autostart=false','mywindow','width=500,height=500')" type="button" /> </form>


Itemid Explained

I hope this helps.

Jesus Loves You.

Nick

Re:Itemid challenges 12 Jun 2010 16:50 #2281

  • Tom
  • OFFLINE
  • Administrator
  • Posts: 860
So maybe you can help me out here, Nick.

I will check to see if I can get the itemid back in the GET variable - that will probably fix this problem.

What I was trying to accomplish was to get the component to count plays. To do that I needed to fire a small function that hits the plays field in the db. I need to know the id of the mediafile in order to do that.

The problem I ran into was that I couldn't figure out how with javascript I could accomplish this. So what I did was do the page refresh - basically the controller is sending the page back to where it came from - but setting another variable play=1 which tells the helper mediatable.php to instead of making a link, fire a function in the classes/class.mediadisplay.php which in turn has a function to increment the hit counter.

If there is a simpler way to do this I'm all for it.

I did find an error in the controller.php file (in the component's root - components/com_biblestudy). I was trying to pull $Itemid from the GET string - and I mispelled something. Try this new file and see what happens. Rename to .php of course.

Tom

File Attachment:

File Name: controller.txt
File Size: 3973
"You shall know the truth and the truth shall set you free." JC
Last Edit: 12 Jun 2010 16:53 by Tom.

Re:Itemid challenges 12 Jun 2010 22:07 #2282

I have an idea that I started playing with, if the JavaScript calls another page passing the media id then that pop up window could write to the database and play the file.

I know that sounds simple, but it could work.

Nick

Re:Itemid challenges 13 Jun 2010 07:12 #2283

  • Tom
  • OFFLINE
  • Administrator
  • Posts: 860
That's the same idea I had. I was able to do the javascript part but when I tried to create the page that alters the db I ran into problems in that the page wasn't part of the Joomla framework - I couldn't get the javascript to envoke a file that Joomla would recognize and thus give access to altering the db.

Basically with AVR I have code in the AVR popup/view.html.php file invoke the incrementing - it was the internal player and direct file link options that I couldn't do that way.

If there is a way to do I am all for it, though!

Tom
"You shall know the truth and the truth shall set you free." JC

Re:Itemid challenges 13 Jun 2010 16:01 #2286

I got it to work in test. The JavaScript needs to call a Joomla supported format.

JavaScript to open Window.
<form> <input value="New Window!" onclick="mywin=window.open('http://dev.newhorizoncf.org/index.php?option=com_biblestudy&amp;view=popup&amp;Itemid=7&amp;mediaid=3','mywindow','width=500,height=500')" type="button" /> </form>


Window JavaScript is calling
<?php
 
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();
 
echo "Test biblestudy<BR><BR><BR>";
 
//Use only component template
JRequest::setVar('tmpl', 'component');
 
$database = & JFactory::getDBO();
 
$mediaid = JRequest::getVar('mediaid');
 
$query = 'SELECT filename'
. ' FROM #__bsms_mediafiles'
. ' WHERE id like "'. $mediaid .'"';
$database->setQuery( $query );
$mediafilename = $database->loadResult();
echo $mediaid. "<BR><BR>";
echo $mediafilename;
?>


You can see that with this you can read from the mediafile database and do everything needed, including adding the Title and Scripture to window. I know that there have been requested for the Title and Scripture to display in the popup window.

Nick

Re:Itemid challenges 13 Jun 2010 17:29 #2288

  • Tom
  • OFFLINE
  • Administrator
  • Posts: 860
Well I think that's really exciting, Nick. Let me play around with this - and I may have other questions - but this would certainly simplify the code a great deal - perhaps I should have just asked for your help in the first place

Blessings on you.

Tom
"You shall know the truth and the truth shall set you free." JC
  • Page:
  • 1
  • 2
Moderators: Richard Hunt
Time to create page: 0.94 seconds