开发者

PHP text-size selector within a Drupal site only working when logged in

开发者 https://www.devze.com 2022-12-17 18:26 出处:网络
I have a PHP text-size select function within a Drupal site: It uses this selector...: <ul id=\"font-sizes\">

I have a PHP text-size select function within a Drupal site:

It uses this selector...:

<ul id="font-sizes">
        <li class="one"><a href="<?php global $base_url; print $base_url;?>/sites/all/themes/x/resize.php?set=small">Normal Font-Size</a></li>
        <li class="two"><a href="<?php global $base_url; print $base_url;?>/sites/all/themes/x/resize.php?set=medium">Medium Font-Size</a></li>
        <li class="three"><a href="<?php global $base_url; print $base_url;?>/sites/all/themes/x/resize.php?set=large">Large Font-Size</a></li>
</ul>

...which modifies a stylesheet link...:

<link rel="stylesheet" type="text/css" media="screen"  href="<?php global $base_url; print $base_url;?>/sites/all/themes/x/<?php echo isset($_COOKIE['sitestyle'])?$_COOKIE['sitestyle']:'small'; ?>.css" />

... by using this file (resize.php):

<?php setcookie ('sitestyle', $_GET['set'], time()+31536000,'/', 'mysite.co.uk', '0'); header("Location: ".$_SERVER['HTTP_REFERER']); ?>

Now, my problem is that it works fine when logged into the CMS (as the main admin or a lower level role), but it ju开发者_运维问答st does not work when accessing the site as an anonymous user. I've been through the permissions settings, but I can't for the life of me see anything that would affect this. I'm guessing therefore it's do to with some higher-level PHP access thing that is beyond me.

Any ideas?


Drupal is often set to cache pages for anonymous users. So even if the cookie is set the page returned will be the same.

If your server can handle the load you could disable caching in the admin performance page and it should then work.

0

精彩评论

暂无评论...
验证码 换一张
取 消