Include in a file wrong direction [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
When i include a file in like 1/2/3/file.php and in the file i do <?php include ('../file2.php'); ?> it sends me to : 1/2/3/../file2.php
it should just send me to ../file2.php. It seems like it does not use the ../ . Also the file does exist.

try to use __DIR__
<?php include (__DIR__.'../file2.php'); ?>

Related

is there a php code that include/require a page and not a file? (PHP) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I have a page 'Error 404' and the address is like http://myurl.com/error404
the php file of error404 require's the index.php to properly show it.
I need a php code that will load or show the content in the url above without redirecting/changing the url. thanks
echo file_get_contents("http://myurl.com/error404");
Works also for URLs.
DOCS

I want to call Comments.php file in sidebar.php file [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have comments.php file i need to call it in sidebar file so that comments shld be in sidebar. I use genesis theme.Thanks in advance.
You aren't providing much detail here, but just looking at your question, all you need is a
include("comments.php");
In you sidebar.
sidebar.php
<?php
require('comments.php');
?>

Put PHP code in existing PHP code [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Here is the code:
<?php if(function_exists('mk_slider')){mk_slider(427);} ?>
I need to put code
<?php the_field('slider_id'); ?>
instead of 427 in previous code, but it does not work, how shell i do it?
Help plz!
Try
<?php if(function_exists('mk_slider')){mk_slider(get_field('slider_id'));} ?>
^^^^^^^^^^^^^^^^^^^^^^
... and as a side note, now I need a shower. Dealing with wordpress code always leaves me feeling dirty/abused.

Php Rewrite text file content [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have basic php knowledge. I have a text file that I need to rewrite the content of - so text file name stays the same but content changes. How do I do that? Thanks in advance.
Use this
<?php
$cont = "newcontentofyourfile";
$var=fopen("yourfile.txt","w");
fwrite($var, $cont);
fclose($var);
?>

PDO PHP how to customize header function [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
is there any way i can get the id inside this code:
header('Location: assigned.php?success?$ticket_id');
I am new to PDO. sorry for the simple question
You are adding ? twice. it should be like..
header('Location: assigned.php?success='.$ticket_id);

Categories