help with url variable
Posted: 31 August 2010 09:14 AM   [ Ignore ]  
Grad Student
Rank
Total Posts:  42
Joined  11-10-2009

I’m trying to place a button with a link as an embed in a page. Works all well, the button is there and as long as I use an absolute href in the embeded page the button links nicely to whatever href given. Using EE 1.6.9

However I want the href to be given as a variable. As soon as I’m doing that the link doesn’t work anymore and the page renders the url twice. This is the code in the embed document, where simpel_subtitel is the variable for the url.

<div id="buttons" class="append-bottom">
    <
img class="decowhite" src="../../resources/img/decowhite.png" alt="decoratie"/>                    
    <
hgroup class="aside">
    
{exp:weblog:entries weblog="button" limit="1" status="Open" dynamic="off"}        
    
<class="aside">{simpel_tekst}</p>
    <
class="button medium green " href="{simpel_subtitel}">{title}</a>
    
{/exp:weblog:entries}
</div

The embed relation in the final document looks like this:

<div id="content" class="container normalbackground">
                <
aside class="span-8">
                                
                <!-- 
sidenav elementen worden per pagina geselecteerd -->
                
                    
{embed="embed/_sidenav"}
                    
                    {exp
:weblog:entries weblog="firstlevel" limit="1" status="Open"}
                                            
                        {if {side_selection
:selected option="Adres"}}
                        {embed
="embed/_address"}
                        {
/if}
                        {if {side_selection
:selected option="Googlemap"}}
                        {embed
="embed/_googlemaps"}
                        {
/if}
                        {if {side_selection
:selected option="Testimonial"}}
                        {embed
="embed/_testimonial"}
                        {
/if}
                        {if {side_selection
:selected option="Video"}}
                        {embed
="embed/_video"}
                        {
/if}
                        {if {side_selection
:selected option="Advertentie"}}
                        {embed
="embed/_advert"}
                        {
/if}
                        {if {side_selection
:selected option="Fotos"}}
                        {embed
="embed/_fotos"}
                        {
/if}    
                        {if {side_selection
:selected option="Nieuws"}}
                        {embed
="embed/_nieuws"}
                        {
/if}                                                        
                        {if {side_selection
:selected option="Freepass"}}
                        {embed
="embed/_freepass"}
                        {
/if}    
                        {if {side_selection
:selected option="Button"}}
                        {embed
="embed/_button"}
                        {
/if}                                    
                
                
<!-- end sidenav elementen --> 

Any glue?

Profile
 
 
Posted: 31 August 2010 03:18 PM   [ Ignore ]   [ # 1 ]  
Chancellor's Fellow
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33338
Joined  05-15-2004

You cannot split your tags like this. An open {exp:weblog:entries} tag can’t be closed by a tag in a sub-template, and they shouldn’t be nested, either. What is {simpel_subtitel}, a global variable?

Profile
MSG
 
 
Posted: 31 August 2010 04:55 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  42
Joined  11-10-2009

{simpel_subtitel} is a custom field in the “button” weblog holding the URL.

Profile
 
 
Posted: 01 September 2010 07:07 AM   [ Ignore ]   [ # 3 ]  
Chancellor's Fellow
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33338
Joined  05-15-2004

Please try to simplify your template as much as possible. In your example code you are separating opening and closing tags. Perhaps you should get it to run without any embeds first? Does that work?

Profile
MSG
 
 
Posted: 02 September 2010 03:15 AM   [ Ignore ]   [ # 4 ]  
Grad Student
Rank
Total Posts:  42
Joined  11-10-2009

Communicating in a different then my native language is always difficult so let me rephrase the question (and perhaps make it a bit easier to understand). I noticed a similar issue on another part of the site. This is the code:

<div id="video">
    
{exp:weblog:entries weblog="video" limit="1" status="Open" dynamic="off" orderby="random"}                        
    
<img class="decowhite" src="../../resources/img/decowhite.png" alt="decoratie"/>
        <
hgroup class="aside">
            <
h2 >Kom binnen</h2>
            <
h3 class="h3lijn">en bekijk de video van ons centrum</h3>
        </
hgroup>
    <
video controls width=260 height=150 poster="{video_poster}">
        <
source src="{video_xml}" type=""></source>
        <
class="aside"Deze browser ondersteund HTML5 video niet</p>
    </
video>
    
{/exp:weblog:entries}                    
</div

At the line “source” there is the custom field type {video_xml}. This field type contains the following link: http://perico.slideshowpro.com/albums/011/998/album-126195/lg/SPINNING.mp4 stored in a text input field with no formatting option.

Now as soon as I render the page it returns this:

<source src="<a href="http://perico.slideshowpro.com/albums/011/998/album-126195/lg/SPINNING.mp4">http://perico.slideshowpro.com/albums/011/998/album-126195/lg/SPINNING.mp4</a>" type=""></source> 

Obviously the link is not working as it should return this:

<source src="http://perico.slideshowpro.com/albums/011/998/album-126195/lg/SPINNING.mp4" type=""</source

What am I doing wrong?

Profile
 
 
Posted: 02 September 2010 03:52 AM   [ Ignore ]   [ # 5 ]  
Grad Student
Rank
Total Posts:  42
Joined  11-10-2009

Ingmar,

Solved the issue myself. I was not aware of the option: “Automatically turn URLs and email addresses into links” in the weblog preferences was set by default to “yes”.

Thanks anyway..

Profile
 
 
Posted: 02 September 2010 08:47 AM   [ Ignore ]   [ # 6 ]  
Chancellor's Fellow
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  30387
Joined  04-29-2002

Glad you were able to figure out what the problem was. Don’t hesitate to post again as needed.

Profile
MSG