Welcome Guest, Not a member yet? Register   Sign In
Redirect to an external site without using PHP
#1

[eluser]Walle[/eluser]
Hello,

I have a small question. I would like to create a link which directs me to an other external site, but I don't want to use PHP for it.

I have a small website, which fetches the html data for a page from a database (clob). I can't really use PHP functions in a clob, that's why I don't want tu use PHP to redirect me to an other site.

I've found the thread '301 redirect to an external site' (https://ellislab.com/forums/viewthread/164701), but the solutions in there are only by php.

Example: This is the data that I put into a clob on the database

Code:
<a href="http://www.example.com">Link</a>

But when I click on the link, the browser wants to navigate to

Code:
www.myproject.com/http://www.example.com

Which is a link that obviously doesn't exists. Is there any way I can fix that?

Thanks in advance,

Walle
#2

[eluser]InsiteFX[/eluser]
The only way to fix that would be to hard code it into your html view file.
#3

[eluser]Walle[/eluser]
Oh, that's a bummer. Thanks!
#4

[eluser]InsiteFX[/eluser]
Why do you not want to use PHP ? It would make it a lot easier to do.
#5

[eluser]Walle[/eluser]
Well, in stead if creating a huge project with lots of views to navigate to, we decided to create a site which can be built up from a database. So we have one dynamical view like this:

Code:
&lt;?php $this->load->view('template/header'); ?&gt;
&lt;?php echo $navigation ?&gt;
<div id="page-wrapper">
    <div class="row">
        <h2>&lt;?php echo $html['titel']; ?&gt;</h2>
    </div>
    <div class="row">
        &lt;?php echo $html['html']; ?&gt;
    </div>
</div>


&lt;?php $this->load->view('template/footer'); ?&gt;

So it loads the right data from the database when you click on the link in the navigation menu.

Because of that, we need to store html pages into our database, into a clob. I tried to store php in those clobs, but then there was a problem loading the pages onto the view.

The error message I got was "Disallowed Key Characters.", and the system wanted to navigate to
"http://example.com/&lt;?php echo site_url(", which obviously won't work.
#6

[eluser]CroNiX[/eluser]
It makes no sense what you are doing. "instead of creating a huge project with lots of views to navigate to"...What's the difference between that and having the same number of views in the database which really complicates things and goes against the MVC design pattern? Data belongs in the db, not entire views. The views use data from the db. Besides, it's a lot less work for the system to use php to include a view file than a query to the db and retrieve it, then parse it and display it.
#7

[eluser]Walle[/eluser]
I understand your comment/concern, but I was told to do it this way. If my colleagues want to add a page to the site, they just have to store a html file into the database, so the navigation and the view will be automatically added to the project in stead of coding it all by themselves.

Also, if more than one colleague wants to add a page at the same time, they aren't writing in the project simultaneously. Because they simply just need to insert their html file into the database. That is way easier than using software like for example GIT or subversion.

The project consists of two smaller subprojects. A ticketing system (which is completely written in the MVC standards), and a small website that doesn't need to fetch any data from the database that is used for the ticketing system. Those are just views with plain info.




Theme © iAndrew 2016 - Forum software by © MyBB