Yes/No question regarding embedded links

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
Bionic
Forum Newbie
Posts: 4
Joined: Mon Feb 27, 2012 2:10 am

Yes/No question regarding embedded links

Post by Bionic »

Hello. I commissioned a php scripter and he tells me the following thing is not possible (but somehow I can't believe it's impossible because it doesn't seem to be very sophisticated). As I am not a programmer I would like to ask if this is correct.

The script does the following. It presents links and beneath the link are multiple choice questions. The user answers the question and gets the next link presented. Then the users will be matched according to their answers.

The links are stored in a .txt file. This all works except the links are presented as a "string" where the user has to click on. What I want is that the content of the links (e.g. a picture, video ...) is presented. He says that is not possible. Is he right?

Thank you very much!
User avatar
theserve
Forum Newbie
Posts: 24
Joined: Wed Jan 18, 2012 6:35 am
Location: London

Re: Yes/No question regarding embedded links

Post by theserve »

sounds like he is fobbing you off. Of course its possible to link images.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Yes/No question regarding embedded links

Post by social_experiment »

theserve wrote:Of course its possible to link images.
From the OP's explanation this isn't what he wants;
Bionic wrote:What I want is that the content of the links (e.g. a picture, video ...) is presented.
It sounds like the link should display either an image (if the link goes to one) or a video (if the link goes to a video)
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Bionic
Forum Newbie
Posts: 4
Joined: Mon Feb 27, 2012 2:10 am

Re: Yes/No question regarding embedded links

Post by Bionic »

Thanks!

Yes, social_experiment is right. In addition these links have to be somehow identifiable because the corresponding answers have to be stored together with the links in a database. But in my understanding there shouldn't be a difference whether a simple string is fetched from a txt file or a link fetched and then embedded ..
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Yes/No question regarding embedded links

Post by califdon »

We may have a terminology issue here.
It presents links and beneath the link are multiple choice questions. The user answers the question and gets the next link presented. Then the users will be matched according to their answers.

The links are stored in a .txt file. This all works except the links are presented as a "string" where the user has to click on. What I want is that the content of the links (e.g. a picture, video ...) is presented.
I think you can make it clearer to us if you avoid using the word "link" in your description, because it can be interpreted differently by different people. Just state exactly what you want the user to see and do and what you want to happen as a result of that. As it is, I don't have a clear idea of what you expect.
Bionic
Forum Newbie
Posts: 4
Joined: Mon Feb 27, 2012 2:10 am

Re: Yes/No question regarding embedded links

Post by Bionic »

Yes, you are right, I am German origin, so I may sound a bit confusing, sorry :) A clarifying attempt:

So what has to happen is: Questions, videos and pictures will be presented to the user. The user has to answer multiple choice questions beneath these videos, pictures (think about online questionnaires e.g.). The results of each user to each question has to be stored as we need them for further functions.

I described these questions/videos/pictures generally as "links" or maybe I should say URLs(?) because I thought they are just "objects" (I know I have to be careful with programming specific terms, so here I mean object in a general meaning) and it doesn't matter if they contain actually text, images or videos. In order to easily edit and replace these links I told him that the script should extract the links from a txt file so that our administrator can just change the links in the txt file in order to present different questions, pictures and videos.

All this works, but instead of presenting the videos and pictures, the user just gets presented simple text extracted from the txt file.

Thanks again for taking the time to help!
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Yes/No question regarding embedded links

Post by califdon »

OK, that's much clearer. Danke sehr! :-)

Possibly that is also what is confusing your programmer. To many of us, "link" or "URL" means something you click on to reach a different web page. That could explain why he gave you those "strings" when you were expecting the actual images or videos. This is certainly possible. His code would probably need to behave differently, depending on whether the current item is an image, a video, or just a text question, so it would first need to determine which type of item is being processed, then branch to one of several actions, to display text, display an image, or embed a video player in the page that is presented to the user. I can think of several ways to do that, but to answer your question, what you have now described is possible.
Bionic
Forum Newbie
Posts: 4
Joined: Mon Feb 27, 2012 2:10 am

Re: Yes/No question regarding embedded links

Post by Bionic »

I have to say "vielen Dank" :)

Now I have a backed-up argument because he told me, quote: "I have to understand the limitations of technology" ...
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Yes/No question regarding embedded links

Post by califdon »

You may need to store a "code" (perhaps 1, 2, or 3) with each item, to indicate that it is an image, a video, or just a string. If it were me, I would not use a text file, they are much harder to work with than a simple database for such purposes, but that is certainly optional. To make it easy (indeed, much easier) for staff members to add or modify items, you would need a couple more small scripts to permit "administration" of the data in the database. Suitable databases would include MySQL, Postgres, or even the simple SQLite.
arham
Forum Newbie
Posts: 1
Joined: Sat Jan 31, 2015 3:50 am

Re: Yes/No question regarding embedded links

Post by arham »

This is not a question about which template engine to use.
Even the smarty example uses a switch to define pages, which is where I am trying to find a better was of doing it.

At some point you still have to define the logic path of the template, what engine you use is completely up to you.
As with the example of sub pages, even if you have 4 effective levels of pages, logic must be written to determine how you get to those pages and with each level, you are adding infinatly more code if you attempt to do this via a switch within a switch as example.
Post Reply