PHP Notice Undefined index: styles.css


(John) #1

Hi,


I have been evaluating Matix for a week or so now but seem to have a problem with including links to css files as follows:


    


The css file is located in the designs Folder. If I attempt to reference it via hardcoded URI i.e. http://blahblablah.gov.au/styles/styles.css it works fine.

Any clues???


Thanks in advance....John.

(Avi Miller) #2

The file must be directly linked under the Design you're calling it from. It must also be live, with the correct read permission (usually, Public Read for a public website).


(John) #3

[quote]The file must be directly linked under the Design you’re calling it from. It must also be live, with the correct read permission (usually, Public Read for a public website).
[right][post=“6495”]<{POST_SNAPBACK}>[/post][/right][/quote]



Hi Avi,



As far as I can tell I do have it directly linked under the Design I’m calling it from it is also live and has public permissions set. In pointof fact I made the entire designs folder live and public readable. Actually, it is not just css sheets it is anything prefaced by

    mysource_files/whatever.file
throws the following error:


    PHP Notice Undefined index: styles.css 
    " />  PHP Notice Undefined index: corporate 
    /logo_home.gif" />


I assume "mysource_files" is a mapping of some description am I supposed ot have done something with this mapping. I don't know... registered it, linked it changed a property for it somewhere?

I am using Squiz MySource v3.6.0 RC1 (Matrix) running on Linux with Postgres

Thanks once again...John

(Avi Miller) #4

[quote]I assume “mysource_files” is a mapping of some description am I supposed ot have done something with this mapping. I don’t know… registered it, linked it changed a property for it somewhere?
[right][post=“6499”]<{POST_SNAPBACK}>[/post][/right][/quote]



Matrix automatically replaces all mysource_files/filename.gif representations with the proper URL for the asset on output. By the look of that error, it seems there’s a corporate/ location added. This is not permitted by the replacement system. All files should be represented simply by using the mysource_files/filename.ext location.



Also, make sure your Designs folder itself has a proper (valid) URL.


(John) #5

[quote]Matrix automatically replaces all mysource_files/filename.gif representations with the proper URL for the asset on output. By the look of that error, it seems there’s a corporate/ location added. This is not permitted by the replacement system. All files should be represented simply by using the mysource_files/filename.ext location.


Also, make sure your Designs folder itself has a proper (valid) URL.

[right][post=“6500”]<{POST_SNAPBACK}>[/post][/right][/quote]



Hi Avi,



Now I’m really confused. I’ve moved css files into a design then out of the design. I’ve moved the design into teh root of the web then back outside of the web. In fact it doesn’t seem to matter where I put files or what the files are I get the same error.



I strongly believe that to solve this problem we have to deal with the error message itself So, can you tell me specifically what does this error mean:


    PHP Notice Undefined index: 


where <anyfilename> is the name of a file appended to the mysource_files/ mapping/path

i.e. what does "undefined index" mean? Once we understand that we can solve the problem otherwise we are just randomly pulling switches in the hope it will fix the problem.

Frustrated...John.

(Avi Miller) #6

[quote]i.e. what does “undefined index” mean? Once we understand that we can solve the problem otherwise we are just randomly pulling switches in the hope it will fix the problem.
[right][post=“6506”]<{POST_SNAPBACK}>[/post][/right][/quote]



Undefined index means that the Matrix design cannot find the file specified by the filename after the mysource_files/ virtual location. Here’s how it should look in the Asset Map:


    - Designs Folder (URL: [b]system.root.url/_designs[/b])
      |
      + My Design (Design Asset)
          + styles.css
          + logo.gif
          + background.gif


The three files [i]must[/i] be uploaded as Associated Files of the Design asset (on the Details screen of the Design asset itself). Then, inside the parsefile, you would use them like so:

[html]<link rel="stylesheet" href="mysource_files/styles.css" />[/html]

or

[html]<img src="mysource_files/logo.gif" alt="Logo" />[/html]

Matrix will then find the file uploaded as an Associated File that matches the name. It will provide the correct URL at runtime, as Matrix's URLs change depending on the current status and permission of each asset.

Does that make more sense?

(John) #7

That's the trick!! I orginally created the css files straight into the designs folder and then drag-n-dropped them into the design -- big mistake! Because, you can see the CSS file in there but the matrix system has not created an association.

My mistake was assuming that because the system permits me to create a CSS asset under the Design Asset that it automatically creates an association -- it doesn't.

hence my confusion :))

Thanks Avi.

(Avi Miller) #8

[quote]My mistake was assuming that because the system permits me to create a CSS asset under the Design Asset that it automatically creates an association – it doesn’t.
[right][post=“6509”]<{POST_SNAPBACK}>[/post][/right][/quote]



CSS File assets are treated differently by Design assets and are linked via a Linked CSS design area. Ordinary (ie. static) CSS files should just be uploaded as associated files.



Note that you cannot use the mysource_files/ virtual location within an uploaded (associated/static) CSS file. Any CSS tag that needs an image, should be added to a <style> block at the top of the parsefile.