Jump to content


Photo

Easy Question .... I think


  • Please log in to reply
6 replies to this topic

#1 mnybud

mnybud
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 27 August 2006 - 12:05 AM

I am new to PHP and trying merge 2 existing PHP scripts together in a very minor way.
I have a script that looks like this:

<?
    include_once(dirname(__FILE__) . "/class.script.php");
    $name = "changeme";
    etc.......
?>

The other script I have has this to print the names that I am trying to display in the $name= field.
<?php info('name'); ?>


If I put that right above the first script like below it displays the names just fine.

<?php info('name'); ?>
<?
    include_once(dirname(__FILE__) . "/class.script.php");
    $name = "changeme";
    etc.......
?>

BUT if I put it in like below where I want it to display then it does not work.

<?
    include_once(dirname(__FILE__) . "/class.script.php");
    $name = "<?php info('name'); ?>";
    etc.......
?>

I am guessing there is a simple way to write this to make it work but I cant figure it out.....  ???

Any help?






#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 27 August 2006 - 12:11 AM

include_once(dirname(__FILE__) . "/class.script.php");
$name = info('name');

Legend has it that reading the manual never killed anyone.
My site

#3 mnybud

mnybud
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 27 August 2006 - 12:45 AM

yea I tried that already but it does not work.

any other suggestions?

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 27 August 2006 - 01:24 AM

Well, we need more clues. What are you expecting to happen? What is it that "doesn't work"? What does happen? Do you get any error or warning messages? What's in the included file?
Legend has it that reading the manual never killed anyone.
My site

#5 mnybud

mnybud
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 27 August 2006 - 01:58 AM

sorry here is some more info.

I am not getting any errors but instead of pulling the correct page/content from my site it always just loads the index page unless I set it manually.

Here is more of the code:

<!-- begin footer -->
</div>
<?php get_sidebar(); ?>
</div>

<?php footer(); ?>

<--this works-->
<?php info('name'); ?>
<--this works-->

<?
  include_once(dirname(__FILE__) . "/class.script.php");
    $name = info('name');

if (isset($_GET['name'])) {
$name = $_GET['pagename'];
}

$myscript = new pagefetcher();

$cnt = $myscript->FetchFullName($name);

if ($cnt) {
print $cnt;
}
?>
<!-- end footer -->

Let me know if this gives any clues....thanks for your time!

#6 mnybud

mnybud
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 27 August 2006 - 01:32 PM

anyone have any ideas??

#7 mnybud

mnybud
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 27 August 2006 - 08:05 PM

anyone? I know one of you PHP whizes can help.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users