0

I have a newsletter 3rd party system. It has been working really well however I have come across an issue which I'm hoping is a really easy fix.

So this is the root structure of my website

FTP SERVER
/index.php
/news.php
/shane/shane_about.php
/mailist/globals.php
/mailist/mailbar.php
/mailist/mailbar8.php

So I have an input box which allows me to register for a newsletter. It works a treat on index.php and news.php however screws up the whole page on shane_about.php because its in a child directory shane.

Now the problem is in the globals.php

<?php 
$main_dir = "maillist/";
$website = "http://www.mysite.com/";
$relative_string="index.php?page=mail&";
$absolute_path="/hostingcompanyserver/something/something/something.com/maillist/";
$lang="lang_english.php";

So I changed the variable $main_dir to "../mailist/"

This then worked on the shane/shane_about.php, then index.php and news.php had the same issue (it screwed up).

I'm sure the solution is very basic, any thoughts would be appreciated. Thanks Chris

1 Answer 1

2

Change $main_dir to an absolute path.

If it's the same as $absolute_path you won't have this problem.

$main_dir = "/hostingcompanyserver/something/something/something.com/maillist/";

The problem at the moment is index.php and news.php look inside maillist as defined by $main_dir. shane_about.php looks inside /shane/maillist/.

You then told it to go up a directory to maillist with ..maillist/. This meant shane_about.php was looking in the right place but index.php and news.php weren't.

By using an absolute path all files look in the same place.

Sign up to request clarification or add additional context in comments.

1 Comment

That worked a treat, thank you for explaining it too, that made sense :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.