Webmastersite.net
Register Log In

function templatesdir()

Comments on function templatesdir()

Rik
Forum Regular

Usergroup: Customer
Joined: Sep 22, 2004
Location: Wake Forest, NC

Total Topics: 23
Total Comments: 161
Rik
Posted Apr 11, 2006 - 7:47 PM:

I have a wsn links installation, that, on the admin panel, in the menu frame, the small bullet.png image is not being called becuase the path to it is incorrect.

The first item on the menu is "main" with this code:

<a href="index.php?show=main" target="frameright" class="menu"><img src="../templates/default/images/bullet.png" border="0" alt="bullet"> Main</a>


If I change the ../ to be ./ the bullet.png image works.


I see in the classes folder a file settings.php which has this:


function templatesdir()
{
global $inadmindir;
if ($inadmindir) $dir = '../'. $this->templatesdir;
else $dir = $this->templatesdir;
return $dir;
}

I believe this is the source of the ../


This same installation also had a problem finding the css for the admin menus, causing them to look awful. I was able to "correct " that by making an edit in the menu.tpl file as follows:

Original:

<link rel="stylesheet" href="[IFADMIN../]templates/default/admin/style.css" type="text/css">


I edited to:

<link rel="stylesheet" href="templates/default/admin/style.css" type="text/css">


I assume both these problems are related to an incorrect path.

Any ideas where this problem is coming from.

At this point the wsn links install is working ok as far as the public view is concerned, but I would like to correct this admin path problem so I can use unaltered code in the files.

I guess it is obvious that I know very little about PHP at this point.

Rik
Forum Regular

Usergroup: Customer
Joined: Sep 22, 2004
Location: Wake Forest, NC

Total Topics: 23
Total Comments: 161
Rik
Posted Apr 11, 2006 - 8:04 PM:

Let me add this information. The installation I am having problem with has the normal directories:

templates/default
templates/multilingual

but also has as the result of a mod:
templates/classifeds

(more on this mod is here
www.webmastersite.net/forum...ifieds_Templates-4931.html)

In the setup.php file I see:


if (file_exists("templates/default/wrapper.tpl")) $templatesdir = 'templates/default';
else if (file_exists("templates/multilingual/wrapper.tpl")) $templatesdir = 'templates/multilingual';
$saved = $templatesdir;


Since the templates/classifeds directory is not in this code, is this possibly related to my problem?


Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 12, 2006 - 7:33 AM:

Rik wrote:
The first item on the menu is "main" with this code:

<a href="https://www.webmastersite.net/forums/index.php?show=main" target="frameright" class="menu"><img src="../templates/default/images/bullet.png" border="0" alt="bullet"> Main</a>


That looks entirely correct (which explains why it works on every site I've been on). If you don't have a bullet.png at ../templates/default/images/bullet.png relative to the admin directory (which means /templates/default/images/bullet.png relative to the WSN Links base directory), that is your problem and you should upload it.

I suggest you clean up anything you may have harmed in the source code. Using ./ instead of ../ should kill a lot of things.

Since the templates/classifeds directory is not in this code, is this possibly related to my problem?

I presume your username is actually using the default template set, since that's what the html you posted says, so there's no reason to talk about the classifieds directory.

Edit: I remember some really old versions would act differently with mod_rewrite on when going to site.com/admin compared to site.com/admin/ so you might want to check if your .htaccess is up to date.
Rik
Forum Regular

Usergroup: Customer
Joined: Sep 22, 2004
Location: Wake Forest, NC

Total Topics: 23
Total Comments: 161
Rik
Posted Apr 12, 2006 - 10:37 AM:

The bullet.png file is there, and I can force it to appear.

I do want to get the code back to original, but had to make the hack to get it to find the css.

I just want to get my admin working correctly as it has always done in my other wsn links installation.

I'm just too uneducated on php to figure this out by myself. (I am trying.)

The problem is that the url to the bullet.png is missing the directory I have the wsn links installed in. It has the dir above, skips the one wsn links (modified for classifieds) is in, and then goes on to the other dirs all the way to the png file.

Notice where missing dir is:

www.twowayradiodirectory.co...ssifieds/images/bullet.png

Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 14, 2006 - 12:04 PM:

The bullet.png file is there, and I can force it to appear.

If it were there, then outside of a web browser bug HTML is incapable of failing to display the image when you have html source putting an image tag around it. It is therefore clearly not there.

As noted above that could be because you're not actually in the admin subdirectory, due to an old .htaccess.
Rik
Forum Regular

Usergroup: Customer
Joined: Sep 22, 2004
Location: Wake Forest, NC

Total Topics: 23
Total Comments: 161
Rik
Posted Apr 14, 2006 - 2:24 PM:

I copied the .htaccess file in my wsnlinks dir and pasted the copy into my wsnlinks_classifieds dir and as you predicted, it fixed my problem.

Thanks for banging my hard head again!

Rik
Forum Regular

Usergroup: Customer
Joined: Sep 22, 2004
Location: Wake Forest, NC

Total Topics: 23
Total Comments: 161
Rik
Posted Apr 14, 2006 - 2:26 PM:

oops, no it didn't. Now, when I click the admin on the top page of my classifieds wsnlinks, it shows the correct url in the status bar of my browser, but I actually get sent to the admin panel of my wsnlinks.

Rik
Forum Regular

Usergroup: Customer
Joined: Sep 22, 2004
Location: Wake Forest, NC

Total Topics: 23
Total Comments: 161
Rik
Posted Apr 14, 2006 - 2:30 PM:

ok, that was apparently caused by the base in the .htaccess I copied was pointing at /wsnlinks.

I changed the base to/classifieds

Now I am back where I was. Clicking the admin link on the top page, gets me the admin panel, but the link to the bullet.png is broken, so no image.
Rik
Forum Regular

Usergroup: Customer
Joined: Sep 22, 2004
Location: Wake Forest, NC

Total Topics: 23
Total Comments: 161
Rik
Posted Apr 14, 2006 - 2:54 PM:

Now that I have the .htaccess file installed, I am going to go back and correct the changes I made in the template files and see if it all works correctly.
Rik
Forum Regular

Usergroup: Customer
Joined: Sep 22, 2004
Location: Wake Forest, NC

Total Topics: 23
Total Comments: 161
Rik
#10 - Quote - Permalink
Posted Apr 14, 2006 - 4:49 PM:

OK, I now have all the template files with original code.

But, in order to get the admin style.css and bullet.png files to be called correctly, I had to make one edit to the settings.php file.

In this code:

function templatesdir()
{
global $inadmindir;
if ($inadmindir) $dir = '../'. $this->templatesdir;
else $dir = $this->templatesdir;
return $dir;
}

I had to change to:

if ($inadmindir) $dir = ''. $this->templatesdir;


What would make that change necessary?

This is the ONLY code i am running now that I have changed, but it does make the admin panel display correctly.

Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.