# PHP Variables used in normal code = *clock*



## WhiteSuburban (Jun 19, 2012)

*This code is out dated, please use the directory link to view the latest code.*

```
<html><center>
<?php
$textdoc=$_REQUEST['textdoc'];
?>
<FONT FACE="arial"><h4><a href="list.html">Go back to the list</a><br /></h4></FONT>
<object data="'.$textdoc.'" width="600" height="400"> <embed src="'.$textdoc.'" width="600" height="400"> </embed> <br />Error: Embedded data could not be displayed. </object>
</center>
</html></object></center></html>
```
Anyone know how to use PHP variables like so, because it looks like I'm ramming my face at the keyboard.

You can see the code in action here. https://dl.dropbox.com/u/17823794/Stories/text.html
Apparently .html will work also.

You guys can look into the directory of the files. Don't bother me about some stuff that is unrelated. https://www.dropbox.com/sh/2kb5nj6z7lvuszd/9BNxw3DaYU/Stories
I will explain the files

index.html: the main page
list.html: its both what the main page uses for its list and also as a popup
text.html: is the file we are working on, it is the page that will open the text in a way that the visitor can go back to the list by simply clicking the "Go back to list" link
text.php: older file of text.html, I thought file types matter in this one.
(Other Folders): these are the files I use to sort my stories
websong.mp3: the song played on the main page
(Other files): They have little or no purpose to the site.

How I do my writing and how I update the page

I create a text document in the "In progress" folder and give it a name like story, file1, name, etc or when I thought up the story name, just set that as the name.
I begin writing
I change/update the name to the story name for reference
Move the file to the "Ready for Upload" folder.
Upload the file to FurAfinity
Move the file to "Done"
Edit list.html, the file that the main page uses for its list.
Code in the link.
Complete.


----------



## WhiteSuburban (Jun 19, 2012)

Oh, let me warn you, the list is NSFW, soooo...yeah.


----------



## Kihari (Jun 19, 2012)

```
[LEFT][COLOR=#333333]<object data="'.$textdoc.'" width="600" height="400">
```

I can see what you're trying to do here but I'm not going to tell you how to make it work, because that is just terrifying.

A little insight as to why you want the page to take requests in this way?[/COLOR][/LEFT]


----------



## LizardKing (Jun 19, 2012)

Kihari said:


> I can see what you're trying to do here but I'm not going to tell you how to make it work, because that is just terrifying.



Broken PHP 2: Exploit Boogaloo


----------



## kayfox (Jun 19, 2012)

Why not this:
<object data="<?php echo $textdoc; ?>" width="600" height="400"> <embed src="<?php echo $textdoc; ?>" width="600" height="400"> </embed> <br />Error: Embedded data could not be displayed. </object>


----------



## Aden (Jun 19, 2012)

WhiteSuburban said:


> ```
> <FONT FACE="arial"><h4><a href="list.html">
> ```



This is unnecessarily condescending (my apologies), but please join us in the 21st century and use <h4 style="font-family: Arial, sans-serif;"> instead.


----------



## WhiteSuburban (Jun 19, 2012)

Kihari said:


> ```
> [LEFT][COLOR=#333333]<object data="'.$textdoc.'" width="600" height="400">[/COLOR][/LEFT]
> ```
> 
> ...





Aden said:


> This is unnecessarily condescending (my apologies), but please join us in the 21st century and use <h4 style="font-family: Arial, sans-serif;"> instead.


This is the problem, the list is embed into my webpage (and as a popup) and forgot that embed pages work like browsers, they only open new windows when told to do. So the idea of simple webpage that takes requests like so. An exsample would be [noparse]www.website.com/text.html?textdoc=done/story5.txt[/noparse] will open the page and the text document defined in the url will load. The reason of this is because if someone was using the popup or on the main page can go back to the list by clicking the link.

My website is just held together by duct tape and glue.


----------



## WhiteSuburban (Jun 19, 2012)

So do bear my lack of web coding.


----------



## Ricky (Jun 19, 2012)

Why the new post?

There is already a thread describing your lack of experience using PHP.

That said, it would REALLY help if you gave a proper use case.  I'm sure I've run into whatever you're trying to do before.

(even though I'm not a PHP developer, but I've used it before and it's all the same shit anyway)


----------



## WhiteSuburban (Jun 19, 2012)

kayfox said:


> Why not this:
> <object data="<?php echo $textdoc; ?>" width="600" height="400"> <embed src="<?php echo $textdoc; ?>" width="600" height="400"> </embed> <br />Error: Embedded data could not be displayed. </object>


I tried the code, it thinks that the "<?php echo $textdoc; ?>" is just another value, so the embed page comes with the error "*...**/**Stories/%3C?php%20echo%20$textdoc;%20?%3E not found*", otherwords, it trying to open <?php echo $textdoc; ?> as a address.

"Banned is a ban word for Titles? What?"


----------



## WhiteSuburban (Jun 19, 2012)

Any suggestions?


----------



## WhiteSuburban (Jun 19, 2012)

Ok, I fixed that old placement of that thread, anyways, the link of the directory will be posted on the OP (Original Post).


----------



## CerbrusNL (Jun 19, 2012)

Dude, if you want to run php code, the file will have to be named "filename.php"
At least you've started using the CSS I wrote, that's good :3

Any way,
Could you try to explain -exactly- what you want these files to do?
"is the file we are working on, it is the page that will open the text in a way that the visitor can go back to the list by simply clicking the "Go back to list" link"
^ that's a little vague. How are you linking to text.html/php? What do you expect to happen when you open it?


----------



## Kihari (Jun 19, 2012)

WhiteSuburban said:


> This is the problem, the list is embed into my webpage (and as a popup) and forgot that embed pages work like browsers, they only open new windows when told to do. ... The reason of this is because if someone was using the popup or on the main page can go back to the list by clicking the link.



I think that for what you're trying to accomplish (making the list more easily accessible), using Everybody's Favorite Language for a cheap hack is wholly inappropriate. If you just want to avoid having to change a bunch of static pages every time you add a file to your list, try embedding the _list_ (from a static location) into your _document_ pages, and let viewers navigate from there.

If you're just looking for a reason to use PHP, I recommend you turn off your computer.


----------



## WhiteSuburban (Jun 19, 2012)

CerbrusNL said:


> Dude, if you want to run php code, the file will have to be named "filename.php"
> At least you've started using the CSS I wrote, that's good :3
> 
> Any way,
> ...


This is what I mean.
When you click a link on the list, it will open text.html with a param, so if I open file1, it would open text.html?textdoc=done/file1.txt and open it the file on the embed page. Without a param, it will just 404.
Something like this
https://dl.dropbox.com/u/17823794/Stories/text example.html


----------



## WhiteSuburban (Jun 19, 2012)

CerbrusNL said:


> Dude, if you want to run php code, the file will have to be named "filename.php"
> At least you've started using the CSS I wrote, that's good :3
> 
> Any way,
> ...


When I open text.html(or php), it should just 404 the embed page because _blank_ is nonexistent, however if I include a param, lets say textdoc=Done/Suzy.txt, it would open the page and the embed page will open Suzy.txt because it was given Done/Suzy.txt as a source.

Oh, when I use php, for some reason it wants to download the file rather then open it, well only when I open it remotely.


----------



## LizardKing (Jun 19, 2012)

Quick question:

Are you testing this by opening them directly from dropbox, or do you have an actual setup on your computer/somewhere/anywhere?

I have terrible feelings about this whole thing.


----------



## WhiteSuburban (Jun 19, 2012)

LizardKing said:


> Quick question:
> 
> Are you testing this by opening them directly from dropbox, or do you have an actual setup on your computer/somewhere/anywhere?
> 
> I have terrible feelings about this whole thing.


Its planed just to be on dropbox for now. Its just to be a hub for my text documents for my profile.
Yes, I am aware how opening dropbox files work. Opening from your computer via folder will just open it locally, while using the public link is the real business.


----------



## LizardKing (Jun 19, 2012)

WhiteSuburban said:


> Its planed just to be on dropbox for now. Its just to be a hub for my text documents for my profile.
> Yes, I am aware how opening dropbox files work. Opening from your computer via folder will just open it locally, while using the public link is the real business.



I mean are you just renaming this stuff to .php and hoping for the best, or do you actually have php set up? Because it really sounds like the former to be honest, given the results so far.


----------



## Ricky (Jun 19, 2012)

LizardKing said:


> I mean are you just renaming this stuff to .php and hoping for the best, or do you actually have php set up? Because it really sounds like the former to be honest, given the results so far.



hahhahahaha

I was really hoping this wasn't the case

there goes my faith in mankind


----------



## WhiteSuburban (Jun 20, 2012)

Ricky said:


> hahhahahaha
> 
> I was really hoping this wasn't the case
> 
> there goes my faith in mankind





LizardKing said:


> I mean are you just renaming this stuff to .php and hoping for the best, or do you actually have php set up? Because it really sounds like the former to be honest, given the results so far.


You, stop being an ass.
Anyways,
Err, setting php up on Dropbox doesn't sound like a idea that would work. Otherwords, no, I do not.


----------



## WhiteSuburban (Jun 20, 2012)

Hmm, I could just copy my files and turn them into html files with the go back link, but that goes against what I was planning.
Plan:
Make a text hub that I can manage easily by adding a file link to one html file while also being user friendly.
How it so far worked:
I have successively made it easy to add links to the page while being semi user friendly.


----------



## WhiteSuburban (Jun 20, 2012)

Adding how i do my writing process and how I update the page.


----------



## CerbrusNL (Jun 20, 2012)

Suburban, you are aware php only works when you're accessing the php files through a server, right?


----------



## WhiteSuburban (Jun 20, 2012)

CerbrusNL said:


> Suburban, you are aware php only works when you're accessing the php files through a server, right?


Nope.
Still, it seems that it prefers to download the php file then open it when I try to do it remotely, however when I open it locally, it just opens without trying to download.
You have my permission to call me Jarrod if you wish.


----------



## CerbrusNL (Jun 20, 2012)

WhiteSuburban said:


> Nope.
> Still, it seems that it prefers to download the php file then open it when I try to do it remotely, however when I open it locally, it just opens without trying to download.
> You have my permission to call me Jarrod if you wish.



Then I would strongly suggest you take a look at this:
http://www.w3schools.com/php/php_install.asp
(And the rest of the tutorial. You could skip the mysql bits)
The full tutorial starts here:
http://www.w3schools.com/php/php_intro.asp


----------



## WhiteSuburban (Jun 20, 2012)

I don't think trying to install PHP (and apache) on dropbox can work. Can it?


----------



## WhiteSuburban (Jun 20, 2012)

Hmm, let me get my old provider online again.


----------



## WhiteSuburban (Jun 20, 2012)

jarrodmaddyhub.clanteam.com is online, now it needs all the data transferred. The text documents and list can just stay on the Dropbox, considered that will make my life easy.
But I find the sites lack of updated software sketchy, but we are making simple-ish scripts.


----------



## WhiteSuburban (Jun 20, 2012)

Done! Everything seems to running correctly.


----------



## WhiteSuburban (Jun 20, 2012)

Well, Text.html, which is now text.php, WORKS!
Thanks guys.


----------



## WhiteSuburban (Jun 20, 2012)

Hmm, anyone know how I could make the embed page auto size itself according to the size of the window, or if in a embed page itself.


----------



## WhiteSuburban (Jun 20, 2012)

Well, ain't that just dandy, google chrome is the only browser that can open this correctly.
Firefox doesn't text wrap.
IE fails to load the embed page.


----------

