You are here:  » Include page or menu

Support Forum



Include page or menu

Submitted by ser_seven on Sat, 2006-08-19 06:38 in

Hi,
Possible to include a page or a menu in base to the URL of the loaded page?
Very tnks

Submitted by support on Sat, 2006-08-19 06:46

Hello Ser,

Yes - if you want to add some code to the bottom of every page just create a file in the /html/ directory called:

html/user_footer_before.php

This file will then be included at the bottom of every page. By doing it this way, it means you can re-install or upgrade Price Tapestry over the top of your current installation and it will not overwrite the code that you have added to the bottom of your pages.

Cheers!
David.

Submitted by ser_seven on Sat, 2006-08-19 06:57

Hello,

I wanted to do this.... I hope to succeed in making to understand me:)
I load the page www.mysite.com/products/watch, in this page I will have included the menu "menu1.php."
In the page www.mysite.com/products/games I will have included the menu instead menu33.php

That is in base to the loaded page I will have included a different menu

Submitted by support on Sat, 2006-08-19 07:13

Ok, one way to do it is like this:

html/user_footer_before.php

<?php
  
switch($_SERVER["REQUEST_URI"])
  {
    case 
"/products/watch":
      require(
"menu1.php");
      break;
    case 
"/products/games":
      require(
"menu33.php");
      break;
  }
?>

This way, you can choose what file to include based on the URL.

Please note however, that the URLs in your example would not be generated by Price Tapestry. The script generates URLs like this (if you are using search engine friendly URLs):

/merchant/
/category/
/category/watches/
/category/watches/2.html
/product/foo.html
/product/bar.html

These are the sort of values you will see in $_SERVER["REQUEST_URI"], so you may want to match not on the whole URL, but perhaps on only a part of it, for example we can inspect the first 4 characters of the URL:

html/user_footer_before.php

<?php
  
switch(substr($_SERVER["REQUEST_URI"],0,4))
  {
    case 
"/pro":
      require(
"footer_products.php");
      break;
    case 
"/mer":
      require(
"footer_merchants.php");
      break;
  }
?>

Note that the files must be in the /html/ directory unless you provide a relative path, for example require("../myfiles/foo.php");

Hope this helps!
David.

Submitted by ser_seven on Sat, 2006-08-19 07:29

Ok thanks.
I reread for well what you has written me for I don't perfectly know the English and not even the php:)

Every way seems me to have understood.

The pages are those produced by PT to the moment of the importation of the products that I already divide for categories from my CSV.

I now create me the page html/user_footer_before.php and reinstall PT.

Submitted by support on Sat, 2006-08-19 07:49

Hello Ser,

You do not need to re-install PT just to get html_user_footer_before.php to work. It will be picked up straight away by the script, sorry for the misunderstanding.

Cheers!
David.

Submitted by ser_seven on Sat, 2006-08-19 07:51

Perfect it works.
is it possible to put to this in a left column or top page e not in the footer?

Very tnks

Submitted by support on Sat, 2006-08-19 07:56

Exactly the same way, but you call the file:

html/user_header_after.php

^ code in that file will go at the top of the page :)

Cheers,
David.

Submitted by ser_seven on Sat, 2006-08-19 08:04

Sorry...

It possible create a left column a insert it ?

tnks

Submitted by support on Sat, 2006-08-19 08:14

Left column is more difficult, because you have to put code in both the header and the footer. One way is to create a big table, like this:

html/user_header_after.php

<table width='100%'>
  <tr>
    <td valign='top'>
      <!-- insert your left column code here, you can use PHP tags -->
    </td>
    <td valign='top'>

html/user_footer_before.php

    </td>
  </tr>
</table>

Cheers!
David.

Submitted by ser_seven on Sat, 2006-08-19 08:23

Thousand thanks.
I will try

Submitted by noodles on Sun, 2006-10-01 16:16

Would it be possible to insert a left & right column?

Thanks
David

Submitted by support on Mon, 2006-10-02 07:19

Hi,

To get left and right columns you'd need to do something like this:

html/user_header_after.php

<table width='100%'>
  <tr>
    <td valign='top'>
      <!-- insert your left column code here, you can use PHP tags -->
    </td>
    <td valign='top'>

html/user_footer_before.php

    </td>
    <td valign='top'>
      <!-- insert your right column code here, you can use PHP tags -->
    </td>
  </tr>
</table>

Cheers!
David.

Submitted by genehig on Thu, 2007-09-13 21:25

David,
I also want to add a left side vertical menu with items like
"Merchant StoreFronts" which display a list of links to store front software provided by some of the merchants I am affiliate for.
"News" which when clicked links to a page where I have news of interest to my customers.
"Links" which provides a link to some directory software I have.
etc.

I really did not follow the discussion in the thread above. Are the names user_header_after.php and user_footer_before.php significant? Do they have to be named exactly that and what goes in them?

I truly appreciate all the great help you have been providing.
Gene

Submitted by support on Fri, 2007-09-14 09:54

Hello Gene,

Yes - the files must be called EXACTLY as named above. The reason for this is that it allows you to change your look and feel without altering any Price Tapestry scripts, so if you wanted to re-install the script in the future you wouldn't have to do the customisation again.

If you have modified any files and they are not working how you want you can always email them to me and I will have a look for you.

Cheers!
David.

Submitted by rassad on Tue, 2010-09-28 12:27

Hi David,

I also wanted colums on both the left and right so I added the code to make a table, Im just having an issue with the style, I cant seem to remove the border, my site is at {link saved}

thanks

Submitted by support on Tue, 2010-09-28 14:23

Hi,

It looks like the border is being defined in your higher level CSS - the easiest way to remove it is probably to override it with style tags on the table, rows and cells - have a go with:

html/user_header_after.php

<table width='100%' style='border:0px;'>
  <tr style='border:0px;'>
    <td valign='top' style='border:0px;'>
      <!-- insert your left column code here, you can use PHP tags -->
    </td>
    <td valign='top' style='border:0px;'>

html/user_footer_before.php

    </td>
    <td valign='top' style='border:0px;'>
      <!-- insert your right column code here, you can use PHP tags -->
    </td>
  </tr>
</table>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by rassad on Tue, 2010-09-28 14:50

Hi David,

That work, thanks. Im not very good with css.

I wanted to add these colums because after a search I wanted a list of filters to appear, for instance after searching for led tv I want a brand filter to appear and an tv screen size filter, is this possible? keyword triggered filters?

thanks

Submitted by support on Wed, 2010-09-29 09:05

Hi,

Sure, I have some nice filter code - if you would like to email me your search.php and html/user_header_after.php I'll add the code for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by rassad on Wed, 2010-09-29 09:46

Hi David,

My site is not a niche site, so would these filters be triggered by keyword?

Thanks

Submitted by support on Wed, 2010-09-29 09:58

Hi,

Yes - the filters only show merchants/categories/brands relevant to the search term as they are generated by database queries based on the keyword entered...

Cheers,
David.
--
PriceTapestry.com

Submitted by rassad on Wed, 2010-09-29 10:06

thanks, i will sent these now

Submitted by mikecdprice on Fri, 2011-02-18 03:57

Hello,

I tried to add the above code to my site also. I noticed it works on the first page and then on all the other pages there are 2 lefts and 2 rights at the same time. hehe Yikes

Have you seen that before and any idea on how I can fix it?

Thank you,
Michael

Submitted by support on Fri, 2011-02-18 08:54

Hi Mike,

That sounds like html/user_header_after.php and html/user_footer_before.php is being called in by html/searchresults.php in addition to html/header.php and html/footer.php! This is assuming that the problem doesn't occur on the product page also - double check all files in html/ and make sure that only html/header.php includes a reference to html/user_header_after.php, and that only html/footer.php contains a reference to html/user_footer_before.php - that should be all it is...

Cheers,
David.
--
PriceTapestry.com

Submitted by philstone on Fri, 2011-03-25 14:27

hi david

been playing with this script before implementing it into my site.

it works great, the only issue i'm having, if i want to start a new search while on the search.php page, it does't work

example: while on page {link saved} I type a search for netbook

instead it goes to {link saved} while keeping the results of the previous search?

is there a simple solution to repair this david?

Phil Stone
www.buy24-7.net

Submitted by support on Fri, 2011-03-25 14:31

Hi Phil,

Check your code in html/searchform.php, it looks like the search form has lost its closing </form> tag, so it's picking up the second q= value from a later form on the same page - that should be all it is...

Cheers,
David.
--
PriceTapestry.com

Submitted by philstone on Fri, 2011-03-25 14:38

so I NEED my coffee!!!

thanks david!!

regards

Phil Stone
www.buy24-7.net