1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Using a php script in a php script

Discussion in 'PHP' started by Digital Maze, Feb 3, 2011.

  1. #1
    Hi peepz,

    forgive me for what to you guys is proberly a simple matter, but im pulling my hair out trying to solve it.

    I have a babynames web site running in php and mysql. I want to incorperate a blog script into the web site but having problems. So the header and nav of the web site is controlled by one script, and I want to run the blog script on the same page within the babynames script.

    Ive triedusing include files to pull the header of the web site into the blog script, and vice versa., but it does not work. I know my lack of knowledge is prolonging the hair pulling.

    Im currently using an iframe to pull the blog page in to the babyname script, but being in an iframe, may well cause problems with SERPS.

    any advice please would be greatly appriciated. the web site is babynamesuk.co.uk

    thx
     
    Digital Maze, Feb 3, 2011 IP
  2. Falrish

    Falrish Greenhorn

    Messages:
    70
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #2
    a very simple way to fix this is setting the blog as a sub domain (blog.babynamewebsite.com) then the blog will run separate from the main system. Then all you do is add a link to the blog from the main site and vice versa.
     
    Falrish, Feb 3, 2011 IP
  3. Digital Maze

    Digital Maze Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi Falrish

    thanks for your reply.
    An interesting idea. and would work in most aspects. my problem is the links. the top nav A - Z nav bar and search pulls the pages from the DB. I also tried to add the header navigation code from the baby name script and place it in the blog script but no joy.:(
     
    Digital Maze, Feb 3, 2011 IP
  4. Falrish

    Falrish Greenhorn

    Messages:
    70
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #4
    That is an easy fix, all you need to do is add the link to the database. It is not hard.
     
    Falrish, Feb 3, 2011 IP
  5. Digital Maze

    Digital Maze Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi Falrish

    how do you mean link? would I do this in the config.php?

    in the sub domain, would I have to mirror the main site and plug it into the same database?

    sorry for the nub questions :)
     
    Digital Maze, Feb 3, 2011 IP
  6. Digital Maze

    Digital Maze Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I think i see what you mean. will have a play...
     
    Digital Maze, Feb 3, 2011 IP
  7. Falrish

    Falrish Greenhorn

    Messages:
    70
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #7
    you cannot merge two database tables together fluidly. What you would have to do is run them separately. Either that or have the blog system come up in a <?php include(); ?> statement within the body of the main site. you would loose the navigation of the blog but you could then add that later.

    However, I think your best bet is to insert a link to a sub-domain hosted blog into the main systems navigation database, then add the main system into the blog database.
     
    Falrish, Feb 3, 2011 IP
  8. Digital Maze

    Digital Maze Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Ok, thanks, I already tried - <?php include(); ?> statement within the body of the main site..was the first thing I tried, which is why its driving me nuts cause this usually works but never tried to pull a php include into another totally seperate script. The blog is in a subfolder off root, it has a seperate database from the baby script . all I want to do is have a functioning header navigation, so I used an include() to pull the header from the root directory but is part of the baby script. Cannot get it to work :(
    will keep trying and look at what you have surgested.

    thanks fella
     
    Digital Maze, Feb 3, 2011 IP
  9. Digital Maze

    Digital Maze Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Is it possible to use the include() to pull from a completely different script?
     
    Digital Maze, Feb 3, 2011 IP
  10. TheWiseGuy

    TheWiseGuy Member

    Messages:
    113
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    28
    #10
    could you post the url where we can see the problem? is kind of hard to understand otherwise

    Is it a Wordpress blog? or a custom coded one?

    Assuming you're using WP, creating a custom theme around WP that mimics your website would be the easiest solution in my opinion
     
    TheWiseGuy, Feb 3, 2011 IP
  11. G3n3s!s

    G3n3s!s Active Member

    Messages:
    325
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    80
    #11
    how did you tried to that? Any error reportS?
     
    G3n3s!s, Feb 3, 2011 IP
  12. Digital Maze

    Digital Maze Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    hi guys

    thx for your replies. I got it sorted.

    cheers:eek:
     
    Digital Maze, Feb 7, 2011 IP