By doberk on Friday, 20 October 2017
Replies 14
Likes 0
Views 7.6K
Votes 0
Hello, I have used tag {{Event Id:EVID}} to get event ID in my custom layout and print it, and works good. But now I need to save the event ID in a php variable in order to use it in a script of my own.

Can you tell me what could be the code to get the event ID using php? Maybe somenthing like this:

<?php $eventid = getEvid(); ?>

Thanks in advance.
Where are you calling it from? In event details $row->ev_id() or: $row->id() depending on the event or repeat id you want.

Many thanks
Tony
·
7 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you for your reply. I am calling it from event detail page, but it doesn´t work. Maybe something is wrong in my code. I am trying to print the id at first, in order to check the script. This is what I have in my custom layout:


<span>Joomla user ID: </span>
{source}
<?php
$user = JFactory::getUser();
$id = $user->id;
print_r($id);
?>
{/source}
<br/>
<span>Event ID: </span>
{source}
<?php
$eventID = $row->ev_id();
print_r($eventID);
?>


{source}{/source} are tags from the sourcerer plugin, used to insert php in joomla articles and modules. Joomla user ID is showing, but Event ID is not working. This is the error: "Call to a member function ev_id() on null". Same result with function id(). what could be wrong?

Thanks
·
7 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello, any help with this, please?
·
7 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

Are you calling $row after it has been defined?

Many thanks
Tony
·
7 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
I thought $row was defined in the module's source code. Have I to define it? How?

The code above is the unique code I have in my event detail custom layout. I would be very pleasured if you could say me the entire php code with same behavior than {{Event Id:EVID}}

Many thanks
·
7 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
So are you doing this in the latest events module or the event detail?
·
7 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
In event detail.
·
7 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
In that view should be:

$row=$this->data['row'];

Thus defining $row. Then you can use the calls else use: $this->data['row']->ev_id(); for instance.
·
7 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Unfortunately it is still not working. This is the new error:

"Using $this when not in object context"

And this is the code I´m using:


<?php
$row = $this->data['row'];
$eventID = $row->ev_id();
print_r($eventID);
?>


What am I doing wrong?

You can see attached a capture from the page where I am using the code.

Regards
·
7 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

That wouldn't work there I suspect since you are using Sourcer you are not in the template view here you are being passed into a re-formatting view.

To use that code you need to use it in a template override view see:

https://www.jevents.net/docs/jevents/item/template-overrides-event-detail-page

Many thanks
Tony
·
7 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
But I am not gold member, so I can see that document...

what is the file that contents the event details code? in which folder is located?

Thanks
·
7 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
what is the file that contents the event details code? in which folder is located?

Thanks


Could you, please?

Thanks.
·
7 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
It's just the standard Joomla! way to do a template override :-)

See the basic one here:
https://www.jevents.net/frequently-asked-questions/customising-layouts

Many thanks
Tony
·
7 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you mate, maybe I haven´t explained myselft very well, probably for my english. In my last post I was asking for the path of the file which loads the event detail page, in order to create a template override with that file. But don´t worry because I have found it myself in this path:

/components/com_jevents/views/flat/icalevent/tmpl/detail.php

Thanks for your help, you have been very kind
·
7 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post