Code in UDT prevents template that contains the UDT saving

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
davids355
Power Poster
Power Poster
Posts: 279
Joined: Fri Apr 04, 2008 10:08 am
Location: UK

Code in UDT prevents template that contains the UDT saving

Post by davids355 »

I have a UDT with some php code in it, the UDT saves without a problem, and the code displays on my webpage without a problem.

However, If I go to edit the template from where the UDT is called, it will not allow me to save any changes - there is no error, it just will not acknowledge that I have pressed save or update.

I have narrowed the problem code down to these two lines:

Code: Select all

    if (!file_exists($LOCAL_FILENAME)) {
        die("Script error: $LOCAL_FILENAME does not exist. Please create a blank file 

named $LOCAL_FILENAME.");
    }


    if (!is_writable($LOCAL_FILENAME)) {
        die("Script error: $LOCAL_FILENAME is not writable. Please set write permissions 

on $LOCAL_FILENAME.");
   
 }
I am running CMS version 1.11.4.
The code in the UDT is from a third party and intended to display adverts.

If any more info needed let me know, and also if I have posted in the wrong section left me know.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Code in UDT prevents template that contains the UDT savi

Post by Rolf »

I would start with changing die into echo
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
davids355
Power Poster
Power Poster
Posts: 279
Joined: Fri Apr 04, 2008 10:08 am
Location: UK

Re: Code in UDT prevents template that contains the UDT savi

Post by davids355 »

Rolf wrote:I would start with changing die into echo
That's what I done. Just wondered the reason. Also not sure if breaking the code is against terms of third party.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Code in UDT prevents template that contains the UDT savi

Post by velden »

if $LOCAL_FILENAME refers to a relative path that may be the reason.

If possible use an absolute path, best with the use of cmsms properties like root_path (if exists).

Mind that in the admin area your (by default) working from <cmsmroot>/admin/index.php while the frontend works from <cmsmsroot>/index.php
davids355
Power Poster
Power Poster
Posts: 279
Joined: Fri Apr 04, 2008 10:08 am
Location: UK

Re: Code in UDT prevents template that contains the UDT savi

Post by davids355 »

velden wrote:if $LOCAL_FILENAME refers to a relative path that may be the reason.

If possible use an absolute path, best with the use of cmsms properties like root_path (if exists).

Mind that in the admin area your (by default) working from <cmsmroot>/admin/index.php while the frontend works from <cmsmsroot>/index.php
I believe $Local_filename is just a filename, i don't think there is a path appended at all, but i will check.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Code in UDT prevents template that contains the UDT savi

Post by velden »

davids355 wrote:
velden wrote:if $LOCAL_FILENAME refers to a relative path that may be the reason.

If possible use an absolute path, best with the use of cmsms properties like root_path (if exists).

Mind that in the admin area your (by default) working from <cmsmroot>/admin/index.php while the frontend works from <cmsmsroot>/index.php
I believe $Local_filename is just a filename, i don't think there is a path appended at all, but i will check.
Well, that sure is relative then, isn't it?
davids355
Power Poster
Power Poster
Posts: 279
Joined: Fri Apr 04, 2008 10:08 am
Location: UK

Re: Code in UDT prevents template that contains the UDT savi

Post by davids355 »

I take your point. I will investigate this first and then post back.
velden wrote:
davids355 wrote:
velden wrote:if $LOCAL_FILENAME refers to a relative path that may be the reason.

If possible use an absolute path, best with the use of cmsms properties like root_path (if exists).

Mind that in the admin area your (by default) working from <cmsmroot>/admin/index.php while the frontend works from <cmsmsroot>/index.php
I believe $Local_filename is just a filename, i don't think there is a path appended at all, but i will check.
Well, that sure is relative then, isn't it?
Post Reply

Return to “CMSMS Core”