Sorry for asking this question, but I am very new in php and I am stucked at this issue. I use the code part to read a txt file as below:
I want to read a txt file in php and create an event by using the information coming from the text.
events.txt includes:
SEPTEMBER-21-2015-10am
Google Event
http://www.google.com
That is very enjoyable
...
$fh = fopen('events.txt','r');
$counter = 0;
while ($line = fgets($fh)) {
if($counter % 4 == 0)
{
$eventDate = explode("-",$line);
}
if($counter % 4 == 1)
{
$eventTitle = $line;
}
if($counter % 4 == 2)
{
$eventLink = $line;
}
if($counter % 4 == 3)
{
$eventDesc = $line;
}
++$counter;
}
fclose($fh);
I am able to read my file and assign my data to the related variables. However, I would like to use them to create $event1 like:
$event1 = $calendar->event()->condition('timestamp', strtotime($eventDate[0],$arrayDate[1],$arrayDate[2]))->title($eventTitle)->output('<a href=$eventLink target="newWin">[$eventDate[3]+': '+$eventTitle</a><br />$eventDesc');
I couldnt find out the syntax to run something like above. In the original example.php file, it is:
$event1 = $calendar->event()->condition('timestamp', strtotime(date('F').' 21, '.date('Y')))->title('Hello All')->output('<a href="http://google.com">Going to Google</a><br />Description is here.');
I appreciate if someone helps me to learn this.
Thanks!