Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-07-06 08:40:51

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

/path/to/site automatically?

<txp:site_url />files is a great way of producing http://mysite.com/files but is there an equally convenient way to extract the path to site such as:

/home/whatever/public_html/files or
/users/home/whatever/public_html/files or even
/htdocs/mytest/files

I am going to be using zem_ir image replacement plugin and paths such as these are needed. As I am using it for a template, and there are several instances of the path that would need to be changed, some kind of automatic production of this path would help a lot.


BB6 Band My band
Gud One My blog

Offline

#2 2007-07-06 11:49:57

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: /path/to/site automatically?

The constant ‘hu’ always points to the root of your textpattern install.

Offline

#3 2007-07-06 12:04:20

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: /path/to/site automatically?

Thanks, Ruud! I just tried font=”<txp:php>echo hu</txp:php>/files/copper.ttf” and it all seems to work just fine :-)


BB6 Band My band
Gud One My blog

Offline

#4 2007-07-06 13:12:56

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: /path/to/site automatically?

I spoke too soon. I must have been seeing cached pages. I’ve tried a few things such as:
font=”<txp:php>echo hu. ‘files/copper.ttf’;</txp:php>”
but it produces this error message:
Error: The server is missing the specified font ‘C:/xampp\http://localhost/minim/files/copper.ttf’.

So it seems to be mixing up the url and path.


BB6 Band My band
Gud One My blog

Offline

#5 2007-07-06 13:47:13

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: /path/to/site automatically?

Please post your diagnostics here.

Offline

#6 2007-07-06 15:34:37

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: /path/to/site automatically?

Here you are. The prefs changes is to enable comment preferences. The clean url test has failed for about 6 months but not affected anything as far as I can tell. It always used to work before that.

————————-
Textpattern version: 4.0.4 (r1956)
Last Update: 2007-06-29 18:29:33/2006-08-31 16:47:58
Document root: C:/xampp/htdocs (C:\xampp\htdocs)
$path_to_site: C:\xampp\htdocs\minim
Textpattern path: C:\xampp\htdocs\minim\textpattern
Permanent link mode: section_title
upload_tmp_dir: .;C:\xampp\tmp
Temporary directory path: C:\xampp\htdocs\minim\textpattern\tmp
Site URL: localhost/minim
PHP version: 5.0.4
Server Local Time: 2007-07-06 16:31:27
MySQL: 4.1.12
Locale: English_United Kingdom.1252
Server: Apache/2.0.54 (Win32) mod_ssl/2.0.54 OpenSSL/0.9.7g PHP/5.0.4
Apache version: Apache/2.0.54 (Win32) mod_ssl/2.0.54 OpenSSL/0.9.7g PHP/5.0.4
PHP Server API: apache2handler
RFC 2616 headers:
Server OS: Windows NT 5.1
Active plugins: hcg_templates-0.3, zem_contact-0.6, glx_hl_current-0.3, upm_savenew-0.4, zem_ir-0.5m

Pre-flight check:
————————————
Some Textpattern files have been modified: /include/txp_prefs.php
Clean URL test failed.
————————————

.htaccess file contents:
————————————
#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#RewriteBase /relative/web/path/

<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+) – [PT,L]

RewriteRule ^(.*) index.php </IfModule>

php_value register_globals 0
————————————

Last edited by zero (2007-07-06 15:37:19)


BB6 Band My band
Gud One My blog

Offline

#7 2007-07-06 16:04:32

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: /path/to/site automatically?

If you just do <txp:php>echo hu;</txp:php>, what does that show as a path?

Offline

#8 2007-07-06 16:25:17

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: /path/to/site automatically?

I get ‘cannot create heading’ but if I put
font=”<txp:php>echo hu;</txp:php>files/copper.ttf”
I get:
Error: The server is missing the specified font ‘C:/xampp\http://localhost/minim/files/copper.ttf’.

I just tried this on a website with clean urls working and have the same problem.

I am putting this inside <txp:zem_ir_set. I’ve used it in a form and on a page but still the same results.


BB6 Band My band
Gud One My blog

Offline

#9 2007-07-06 16:57:37

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: /path/to/site automatically?

Hmm… but I think I misunderstood you, because you probably want the path on the server, instead of creating an URL (which “hu” is used for), so try this:

<txp:php>global $path_to_site; echo $path_to_site;</txp:php>

Offline

#10 2007-07-06 17:06:00

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: /path/to/site automatically?

Yes, I don’t want a url. I tried exactly what you wrote and now get this:

Error: The server is missing the specified font ‘C:/xampp\C:\xampp\htdocs\minim/files/copper.ttf’.

So it’s a little bit nearer…


BB6 Band My band
Gud One My blog

Offline

#11 2007-07-06 17:31:05

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: /path/to/site automatically?

That’s weird… what happens if you put the last bit of code I suggested in a TXP template alongside other plain text and then visit a page that uses this template. I’m interested in seen what value $path_to_site has.
I think somewhere in the plugin the “c:/xampp\” part is added.

Offline

#12 2007-07-06 17:33:11

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: /path/to/site automatically?

Note that if I put copper.ttf in the xampp folder it all works. However, I want to be able to upload the font to the files folder via txp file upload.

Zem_ir creates and uses xampp/images/zir folder by default, and seems designed for fonts to go directly in the xampp folder so they are out of the public_html to prevent font downloads. However, there’s a fontdir and a font option to specify different paths, but these don’t work with url but only with server paths. So I want to create a server path automatically so any user of the template doesn’t have to mess about changing server path names.


BB6 Band My band
Gud One My blog

Offline

Board footer

Powered by FluxBB