Jump to content

Argh how does this thing work

Go to solution Solved by rEaGeNeReary,
18 minutes ago, wra2000 said:
5 minutes ago, wra2000 said:

This is the output : Parse error: syntax error, unexpected '$start' (T_VARIABLE) in C:\xampp\htdocs\index.php on line 46

Where do i have to excevute/paste that? :S I know i am a noob  :)

Put some effort on debugging it. There's a missing semicolon before the $start variable.

 

I won't hand-hold you; use google or something.

I tried this thing....;)https://gist.github.com/jtdroste/2364240o.O

Don't ask me why it's just awesome xD

But i cannot get it to work :S

Does any one who knows php know what i am doing wrong?

 

Index.php : just the one page blog no changes

server : XAMMP local

Other files in www directory : footer.php and header.php both with no content.

other directories : posts

In posts : test.txt

 

Content of test.txt :

 

%s post_(title|font-size: 16px;|4/4/2016)

test

 

What am i doing wrong :S

Thanks so much!

:|

 

EDIT : Whoops!:S i forgot the error

 


Fatal error: Call to undefined function is_numberic() in C:\xampp\htdocs\index.php on line 38

 

Link to comment
https://linustechtips.com/topic/546352-argh-how-does-this-thing-work/
Share on other sites

Link to post
Share on other sites

2 hours ago, rEaGeNeReary said:

Isn't the error message self-explanatory? There's no is_numberic() function and you must have misspelled it for is_numeric().

Thanks so much!:)

It has changed now it gives me this :

 

Notice: Undefined index: page in C:\xampp\htdocs\index.php on line 35
./posts/post_title_body_date.
Posted on 2/12/2016

%s post_(title|font-size: 16px;|4/4/2016) ja

Notice: Undefined offset: 1 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 1 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 1 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 2 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 2 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 2 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 3 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 3 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 3 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 4 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 4 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 4 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 5 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 5 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 5 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 6 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 6 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 6 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 7 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 7 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 7 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 8 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 8 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 8 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 9 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 9 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 9 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50

Do you know what this means?

 

Thanks!!!!:)

Link to post
Share on other sites

26 minutes ago, wra2000 said:

Thanks so much!:)

It has changed now it gives me this :

 


Notice: Undefined index: page in C:\xampp\htdocs\index.php on line 35
./posts/post_title_body_date.
Posted on 2/12/2016

%s post_(title|font-size: 16px;|4/4/2016) ja

Notice: Undefined offset: 1 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 1 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 1 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 2 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 2 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 2 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 3 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 3 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 3 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 4 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 4 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 4 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 5 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 5 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 5 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 6 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 6 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 6 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 7 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 7 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 7 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 8 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 8 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 8 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50


Notice: Undefined offset: 9 in C:\xampp\htdocs\index.php on line 48

Notice: Undefined offset: 9 in C:\xampp\htdocs\index.php on line 49
Posted on 1/1/1970
Notice: Undefined offset: 9 in C:\xampp\htdocs\index.php on line 50

Warning: file_get_contents(): Filename cannot be empty in C:\xampp\htdocs\index.php on line 50

Do you know what this means?

 

Thanks!!!!:)

What's supposed to be the output? What's the data that it's supposed to be getting on its variables?

 

The undefined offset is referring to the variable $config and its key.

Link to post
Share on other sites

Just now, rEaGeNeReary said:

What's supposed to be the output? What's the data that it's supposed to be getting on its variables?

Honestly :)i think it is supposed to have the posts on top of each othero.O there is no example of what it should be on the github page:S where i got the code from...

 

Thanks!

 

And i know that works but i have no idea what the errors are :S

Link to post
Share on other sites

1 minute ago, wra2000 said:

Honestly :)i think it is supposed to have the posts on top of each othero.O there is no example of what it should be on the github page:S where i got the code from...

 

Thanks!

 

And i know that works but i have no idea what the errors are :S

I've updated my last answer.

 

Do some basic troubleshooting by printing what the values of $config and others using print_r().

Link to post
Share on other sites

2 minutes ago, wra2000 said:

Where do i have to excevute/paste that? :S I know i am a noob  :)

On lines 48, 49, and 50.

 

from this:

// ... snip ...
} else {
		$page = (int) $_GET['page'];
	}
	
	$start = $page*$config['posts_per_page']-$config['posts_per_page'];
	for ( $i=0; $i < $config['posts_per_page']; $i++ ) {
		$id = $start+$i;
// ... snip snip

to this:

// ... snip ...
} else {
		$page = (int) $_GET['page'];
	}
	print_r($config); // <-- print what value $config has
    print_r($page * $config['posts_per_page'] - $config['posts_per_page'] ) // <-- print what's the result of this              
	$start = $page*$config['posts_per_page']-$config['posts_per_page'];
	for ( $i=0; $i < $config['posts_per_page']; $i++ ) {
		$id = $start+$i;
// ... snip ...

 

I've pasted that on my test apache server and it only printed (after i've removed lines referencing 'header.php' and 'footer.php')

Sorry, no posts yet!

I don't know what you're expecting to see as I've no information on what files it is fetching on the txt files it's referencing.

Link to post
Share on other sites

18 minutes ago, wra2000 said:
5 minutes ago, wra2000 said:

This is the output : Parse error: syntax error, unexpected '$start' (T_VARIABLE) in C:\xampp\htdocs\index.php on line 46

Where do i have to excevute/paste that? :S I know i am a noob  :)

Put some effort on debugging it. There's a missing semicolon before the $start variable.

 

I won't hand-hold you; use google or something.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×