How to access google map through google map API in codeigniter - php

I Have downloaded the google map library from GitHub and added it in to my libraries in Codigniter. After that I have loaded this library to the controller:
$this->load->library('googlemaps');
and then:
$this->googlemaps->initialize();
$data['map'] = $this->googlemaps->create_map();
After that I have added this in my view:
<?php echo $map['js']; ?>
<?php echo $map['html']; ?>
But something is wrong when I am trying to access the Google Map.
Can anyone help me?

Related

How to use PHP with Composition API VueJS 3

Coming from a PHP/jQuery background, where you can have PHP and jQuery code in the same file, for example some file called index.php:
<?php
echo "hey";
?>
<script>
$("#someId").html("abc")
</script>
How can you do something similar with the Composition API in VueJS v3 where you can access access your PHP variables/sessions etc. inside of a .vue file or have your SFC files to include PHP code as well?
I know you can do this by including the vue framework with script tags inside of your index.php file but as far as I'm aware you can't use the Composition API with this method.
I'm probably missing something basic but I haven't been able to find the answer.

How to properly include php files inside wordpress plugin

Hi I am creating my first custom wordpress plugin.
I have run into an issue when I try to create a link in an included file to one of the plugin menus in the dashboard.
Here is my code for the link
<p>Add a new record</p>
>
As you may have noticed it is using a full URI.
I have tried using ?page=add-members as the href source and it seems to work.
I am wondering if that is the appropirate method to do this or if there is a more standardized way.
Thanks in advance.
I believe what you are looking for is the get_site_url function.
<?php echo get_site_url(); ?>
So ideally you would link it like:
<p>Add a new record</p>
You can read about it on the docs.

google maps in laravel project

I am workin on laravel project in which i have to integrate google maps. I am using this package https://github.com/alexpechkarev/google-maps for google maps . I install this package and get api key from https://console.developers.google.com/apis/credentials . then I just follow the usage of this package for example i write the code in my controller
$response = \GoogleMaps::load('geocoding')
->setParam (['address' =>'santa cruz'])
->get();
It giving me data in json encode formate but i dont't know what i do next . How can i display maps . can someone please give me proper example of this package via code i will be thankfull for that thanks in advanced
You need to actually implement the map on the front end in your views:
<div id="map"></div>
<script src="https://maps.googleapis.com/maps/api/js" async defer></script>
<script>
function initMap() {}
</script>
Read this: https://developers.google.com/maps/tutorials/fundamentals/adding-a-google-map#introduction

How to use qr-code in my cakephp project

I found a tutorial on how to generate qr codes with php [here] http://www.terragon.de/index.php?id=273 . I worked through the tutorial and now I want to use it in my cakephp project, but I cannot seem to get it to work.
I added the folder called qr-code to app/lib. Within the folder is another folder called php that contains qr_img.php which contains the essential php code.(app/Lib/qr-cpde/php/qr_img.php)
In the tutorial, I created a file called index.php that contained this code:
<?php
echo "<img src='qr_img.php?d=Cara-Drye' >";
?>
in my code I replaced it with:
<?php
echo "<img src='app/Lib/qr-code/php/qr_img.php?d=Cara-Drye' >";
?>
but I only gt that little image box and no qr code.
Here is my controller
<?php
App::import('Lib','qr-code.php.qr_img.php');
class QrCodesController extends AppController {
//put your code here
public $name = 'QrCodes';
public function index(){
}
}
?>
once I put the source into the images folder in the webroot and changed my code to:
<?php
echo $this->Html->image('/img/qr-code/php/qr_img.php?d=Cara-Drye');
?>
everything worked fine. The thing about cakephp is the built in architecture, if you are wanting to use an image, it needs to be in the image folder.
If you dont mind using google, you can use
https://github.com/dereuromark/cakephp-tools/blob/cake2/View/Helper/QrCodeHelper.php
echo $this->QrCode->image($text);
and others like url, sms, tel, ...

Is there an easy way to link TO events in my google calendar?

I'm migrating my library's website from webcal to google calendar. The site is written in PHP and HTML4.01 (moving from transitional towards strict). Is there a programatic way that I can generate links to calender days/entries? With webcal a link to the day view was:
www.mylibrary.com/calendar/day.php?YYYYMMDD
And so it was easy to programatically generate a link to a specific day.
I've been trying to find a way to do similar stuff w/ the google calendar and haven't had much luck. I'd really like to be able to do something like
<p>The summer reading program kicks off <a href="
<?php echo "http://www.google.com/calendar/event?cid=".$mycalenderid."&eventdate=".$year.$month.$day; ?>
">May 5th</a></p>
Is this even remotely possible?
This might not be the "easy" solution you were hoping for but the Zend Framework has a gdata component that can do what you'd like.
The simplest way to include the calendar in your site is to use the Google provided embeddable calendar: http://code.google.com/apis/calendar/publish/. The upside is that all you have to do is toss the iframe code into a page and link to it. The downside is that, as far as I can tell, there's no mechanism for linking to a specific day or event.
To do something similar to what you're asking, you'll need to use the zend Gdata component and program it yourself. So, for days.php, you could do something similar to:
<?php
/**
* Adapted from google API doc example
*/
$day = $_GET['day'];
$nextDay = date('Y-m-d', strtotime($day) + 86400);
$client = new Zend_Gdata_Calendar(); //Not authenticated for public calendar
$query = $gdataCal->newEventQuery($client);
$query->setUser('user#example.com');
$query->setVisibility('public');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setStartMin($day); //Inclusive
$query->setStartMax($nextDay); //Exclusive
$eventFeed = $gdataCal->getCalendarEventFeed($query);
?>
<h1>
<?php print $day; ?>
</h1>
<ul id="days-events">
<?php foreach ($eventFeed as $event): ?>
<li class="event">
<?php print $event->title->text ?>
</li>
<?php endforeach; ?>
</ul>
Google Documentation:
http://code.google.com/apis/calendar/data/1.0/developers_guide_php.html
Zend Documentation:
http://framework.zend.com/manual/en/zend.gdata.calendar.html
Much simpler solution:
if($_REQUEST['showday']!='') {$datetoshow=$_REQUEST['showday'];
$datetoshow = $datetoshow."/".$datetoshow;}
Blah blah page content
if ($datetoshow==""){?>
<iframe srtc=""> .... // regular embed text goes here.
<?} else {?>
<iframe src=""> // Add &mode=DAY&dates=<?echo $datetoshow;?> to the SRC code
<?}
Then it's as simple as calling the page w/ day.php?showday=20100205 or whatever day I want.
Thanks for all the suggestions though!

Categories