Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hello All...

Today I am trying to make the social profiles appear globally, i.e., I want to:
1. Declare the links for the social profiles in the globals.php
2. Make the social profile links appear on every page of the site.

I have done this in every page of my site (I am not taking into consideration the Blog/Portfolio)
Code: Select all
<cms:capture into='profiles_output' >
        <div class="soc-icons"><span>Find Us:</span>
           <cms:if twitter_id>
               <a href="<cms:show twitter_id />"><img src="images/icon-1.jpg" alt="Twitter"></a>
               <cms:set has_profile='1' 'global' />
            </cms:if>
            <cms:if facebook_id>
               <a href="<cms:show facebook_id />"><img src="images/icon-2.jpg" alt="Facebook"></a>
               <cms:set has_profile='1' 'global' />
            </cms:if>
            <cms:if gplus_id>
               <a href="<cms:show gplus_id />"><img src="images/icon-3.jpg" alt="Google+"></a>
               <cms:set has_profile='1' 'global' />
            </cms:if>
            <cms:if elance_id>
               <a href="<cms:show elance_id />"><img src="images/icon-4.jpg" alt="Elance"></a>
               <cms:set has_profile='1' 'global' />
            </cms:if> 
        </div>
       </cms:capture>
      <cms:if has_profile >
         <cms:show profiles_output />
      </cms:if>


And I have also added the code into the globals.php file. Which is:
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Global Settings - Editing' executable='0' >
   <!-- Site Logo -->
   <cms:editable name='logo' label='My Site Logo' type='image' />
   
    <!-- Site Page Names -->
   <cms:editable name='site_name' label='My Site Title' type='text'>Insert Index Page Title Here</cms:editable>
    <cms:editable name='about_name' label='About Page Title' type='text'>Insert About Page Title Here</cms:editable>
    <cms:editable name='services_name' label='Team Page Title' type='text'>Insert Services Page Title Here</cms:editable>
    <cms:editable name='products_name' label='Products Page Title' type='text'>Insert Products Page Title Here</cms:editable>
    <cms:editable name='gallery_name' label='Gallery Page Title' type='text'>Insert Gallery Page Title Here</cms:editable>
    <cms:editable name='blog_name' label='Blog Page Title' type='text'>Insert Blog Page Title Here</cms:editable>
    <cms:editable name='contact_name' label='Contact Page Title' type='text'>Insert Index Page Title Here</cms:editable>
   
    <!-- Social Site Accounts -->
    <cms:editable name='group_social' label='Social Profiles' desc='Your accounts on Social sites' type='group' />
   <cms:editable name='twitter_id' label='Your Twitter ID' group='group_social' type='text'/>
    <cms:editable name='facebook_id' label='Your Facebook ID' group='group_social' type='text'/>
   <cms:editable name='gplus_id' label='Your Google+ ID' group='group_social' type='text'/>
   <cms:editable name='elance_id' label='Your Elance ID' group='group_social' type='text'/>
</cms:template>
<?php COUCH::invoke(); ?>


What I understand while working with couch is that, I should be calling the social profiles in every page as:
Code: Select all
<cms:get_custom_field 'group_social' masterpage='globals.php' /> <!-- (where [i]group_social[/i] is just a word) -->


I cannot figure out what should be the exact way to make the social profile icons appear on every page.

Please Help!!!
@KK and @cheesypoof
Image
where innovation meets technology
Hi,

Simply enclose your code with cms:pages tag to bring in the variables of global.php in context -
Code: Select all
<cms:pages masterpage='globals.php' >
    <cms:capture into='profiles_output' >
    <div class="soc-icons"><span>Find Us:</span>
       <cms:if twitter_id>
           <a href="<cms:show twitter_id />"><img src="images/icon-1.jpg" alt="Twitter"></a>
           <cms:set has_profile='1' 'global' />
        </cms:if>
        <cms:if facebook_id>
           <a href="<cms:show facebook_id />"><img src="images/icon-2.jpg" alt="Facebook"></a>
           <cms:set has_profile='1' 'global' />
        </cms:if>
        <cms:if gplus_id>
           <a href="<cms:show gplus_id />"><img src="images/icon-3.jpg" alt="Google+"></a>
           <cms:set has_profile='1' 'global' />
        </cms:if>
        <cms:if elance_id>
           <a href="<cms:show elance_id />"><img src="images/icon-4.jpg" alt="Elance"></a>
           <cms:set has_profile='1' 'global' />
        </cms:if>
    </div>
    </cms:capture>

    <cms:if has_profile >
        <cms:show profiles_output />
    </cms:if>
</cms:pages>

The above change alone should show the profile buttons as you want.
To streamline things, you can move the code above in a snippet of its own (say, 'profiles.html') and then use <cms:embed 'profiles.html' /> on each page where you want the buttons to appear.

Hope this helps.
Thanks a ton KK...
Its Done!!!
I also made a file and placed it in snippets folder...

You rock!!!
Thanks a lot once again!!!
Image
where innovation meets technology
You are welcome :)
4 posts Page 1 of 1