/    Sign up×
Community /Pin to ProfileBookmark

Mixing jquery with php

I have a jquery calendar in my cakephp application with

[CODE] <?php //foreach ($mealplans as $mealplan){ ?>
{
title: ‘<?php echo $mealplan[‘Mealplan’][‘event_name’] . “, “. $mealplan[‘Mealplan’][‘total_calories’]. ” cals”; ?>’,
start: new Date(y, m, <?php
$event = $mealplan[‘Mealplan’][‘event_date’]; echo substr($event, 0, -8); ?>, 0),
end: new Date(y, m, 16),
allDay: true,
url: ‘http://localhost/mealplans/view/1’
},
<?php //} ?>[/CODE]

When I uncomment foreach and its curly bracket at the end then it prints out the first of my meal plans on January 15 until January 16 but I want it to print out all of them. Most of the php is working in the jquery code it’s just this one part that doesn’t work. When I uncomment the foreach and its end bracket then the calendar disappears. You can see it at [url]http://myownmealplanner.com/calendars/navigate[/url] The calendar code is from [url]http://arshaw.com/fullcalendar/docs/usage/[/url]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@makamo66authorJan 03.2013 — I found the problem. One of the meal plans had no date associated with it and the jquery was corrupted as a result. It works now at localhost.
×

Success!

Help @makamo66 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...