dqtok88424 2014-07-14 20:42
浏览 4
已采纳

too long

This is my first time using CMSMS and after researching, I found I had to use the User Defined Tags (UDTs) to use custom php. I did that successfully and all my code worked. I wanted to include a php file for mobile detection, but when I do and refresh the page, it's just a completely blank page.

When I view the source, it's entirely empty. I have an if statement after the include and narrowed it down to the include line being the problem. It's very simple:

include '/Mobile-Detect.php';
$detect = new Mobile_Detect;

// any mobile device (phones or tablets)
if($detect->isMobile()){
    if(!$_COOKIE['ppc'] == 'true'){
        header('Location: /mobile');
    }else{
        header('Location: /mobile?ppc=true');
    }
}

So I'm not sure why other blocks of code I have in other UDTs works and the include doesn't even throw an error. Hopefully a more experienced CMSMSer can help me out on this.

Thank you

  • 写回答

1条回答 默认 最新

  • dongrou5254 2014-07-14 22:07
    关注

    I got around it by editing the include.php file at the root level. I first had to check if it was an admin page or not since the file is included in the front and back end. Then ran my code to check for mobile devices.

    End result:

    if(!isset($CMS_ADMIN_PAGE)){
    // code to be executed on non-admin pages
    }
    

    Note: I also tried javascript, but in the UDT it was expecting php, so I added it to the template and then it was trying to render the curly braces in my if statement as smarty tags. So annoying.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏