简体   繁体   English

我是否可以将javascript内嵌的php用于我的移动网站?

[英]Can I use a php embed inside a javascript for my mobile website?

I have a javascript that displays a message on a mobile website in a drop-down bubble. 我有一个JavaScript,可在移动网站上的下拉气泡中显示消息。 I also have a lightweight cms that generates simple html files that I use to update portions of the website. 我也有一个轻量级的cms,可以生成简单的html文件,用于更新网站的某些部分。 I use php embed to pull the text from the CMS into the mobile web page. 我使用php embed将文本从CMS拉到移动网页中。

I would like to use the cms to update the text that is inside the drop-down bubble, but it seems to break the javascript when I do. 我想使用cms更新下拉气泡内的文本,但是这样做似乎破坏了javascript。 Is there a way to accomplish my intended goal? 有没有办法实现我的预期目标?

Here is the javascript snippet, minus the script brackets: 这是javascript片段,减去脚本括号:

var addToHomeConfig = {
message2: "REPLACE THIS TEXT WITH .HTML FILE FROM CMS",
message:"Featuring LIVE MUSIC on Thursdays. See our EVENTS menu for schedule.",
textcolor: "#ffffff",
bgcolor: "#69532f",
returningVisitor: true,
animationIn: "drop",
animationOut: "fade",
startDelay:5000,
lifespan:10000,
expire:240,touchIcon:true};

This is a sample of my embed code and the resulting HTML page. 这是我的嵌入代码和生成的HTML页面的示例。 This would replace the "REPLACE THIS TEXT..." part of the snippet above. 这将替换上面代码段中的“替换此文本...”部分。

<?php include("admin/data/blocks/Special-of-the-Day.html"); ?>

The content of this html file is: 该html文件的内容为:

<p>Come down and enjoy Andrea Wirth on the patio between 7pm and 9pm.</p>

您不能在客户端使用服务器端脚本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在JavaScript中使用PHP变量? - How can I use a PHP variable inside of my JavaScript? 如果一个人在移动设备上,如何使用php或JavaScript将他们重定向到我的移动网站? - How do I use php or JavaScript to make a person be redirected to my mobile site if they are on a mobile? 我如何从我的网站拨打移动电话或座机电话。 (在PHP,Flash中..) - how can i call from my website to mobile or landline phones. (in PHP,Flash, ..) 如何在Javascript中访问PHP数组? - How can I access PHP array inside my Javascript? 当我使用JavaScript嵌入时,为什么我的PHP没有激活? - Why does my PHP not activate when I embed it with JavaScript? 我如何将php嵌入此处的文档样式? - How can i embed php inside here doc style? 为什么我不能在 html 代码中嵌入我的 php 代码 - Why I can not embed my php code in html code 如何将Google联系人或日历嵌入到我的PHP网页中 - how can I embed google contacts or calendar in to my php webpage 如何通过 PHP、Javascript 或 API 使用我的网站连接到 vimeo? - How can I connect to vimeo by using my website with PHP, Javascript or an API? 如何使用 PHP 和/或 JavaScript 将用户的分数存储在我网站上的变量中? - How can I store a user's score in a variable on my website using PHP and/or JavaScript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM