How to link to a specific part of a page HTML PHP - php

I am trying to link to a specific part in my php page. I have tried all the other answers on here but none of them have helped my special problem. This is how I am trying to go to the link
<a href="<?php echo $userLoggedIn; ?>#posts_tab">
So when the user clicks the dropdown they see a list of things. One of those things being the word Profile and when the user clicks on their profile they go to their own personal profile. When they are there they have a list of items at the top that look like this:
So what I want to do is when they click the profile they are automatically on the Profile Posts tab. Like a default option. For some reason it's not working for me and I can't figure out why. Any help please ?
header.php:
<a href="<?php echo $userLoggedIn; ?>#posts_tab">
</a>
profile.php:
<a style="color: #000;" id="posts_tab" href="javascript:void(0)" onclick="openCity(event, 'Posts');">
<div class="w3-third tablink w3-bottombar w3-hover-light-grey w3-padding">
<center>Profile Posts</center>
</div>
</a>

I believe this is what you want, you need to let your profile page know that you want to load that part of profile.php, you can do it different ways I have used php and GET as example, I've sent a parameter on the URL and received it on profile.php
header.php
<a href="<?php echo $userLoggedIn; ?>?tab=posts_tab">
profile.php
<?php
$tab = $_GET["tab"];
if ($tab == "posts_tab"){
?><script>openCity(event, 'Posts');</script><?php
}
?>
<a style="color: #000;" id="posts_tab" href="javascript:void(0)" onclick="openCity(event, 'Posts');">
<div class="w3-third tablink w3-bottombar w3-hover-light-grey w3-padding">
<center>Profile Posts</center>
</div>
</a>

Related

WordPress How to link a button to a specific template page?

I have a website with several pages with links/buttons that should lead to a specific page.
Is there a way to link this buttons in a dynamic way, that does not include page ID?
Currently I am doing it this way, with ACF field in which I write in a page ID
<div class="projects-homepage-item">
<?php $projects_page = get_post(get_field('page_id')); ?>
<a href="<?php the_permalink($projects_page->ID); ?>" class="projects-homepage-item-img" target="_blank">
<?php the_post_thumbnail(); ?>
</a>
</div>
Is there something similar to this function that leads to blog/post page?
<div class="news-homepage-btn-wrapper">
<?php printf(__('Pogledaj sve novosti', 'femix')); ?>
</div>

How to redirect to a particular block of html page?

I'm working on a simple project which has a requirement to show a particular block of html by passing an div id to that url.
I have tried so many solutions, but none of them worked for me.
Here is my code.
<div class="row">
<a onclick="redirect_tooltip();">
<i class="fa fa-question-circle" aria-hidden="true"></i>
</a>
</div>
Whenever I click the icon it calls a Javascript function, through that function I tried to pass a url with another page division id
function redirect_tooltip()
{
var source_type = $("#_src_type").val();
if(source_type == "source")
{
window.location.replace(base_url+'/help/tooltip#rtmp_4');
//I have already difined the base url
}
}
My html code:
<div id="rtmp_4">
<h4>Some Title</h4>
<h5> <?php echo trim($tooltip_rtmp_server[1]);?></h5>
<p> <?php echo trim($tooltip_rtmp_server[3]);?> </p>
<h5> <?php echo trim($tooltip_rtmp_stream_name[1]);?></h5>
<p> <?php echo trim($tooltip_rtmp_stream_name[3]);?> </p>
</div>
I need to display only the rtmp block whenever the url executes. Please give me a suggestions like where I am doing the mistake.

generating a html image elements in cakephp

When I browse "localhost/ProjectName/users" then I get a user account image like
But When I browse "localhost/ProjectName/users/add" then I get a user account image like
But I wanna see correct image all actions.
My code is below.
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="img/penguen.jpg" class="user-image">
<?php $this->User = ClassRegistry::init('User');?>
<span class="hidden-xs">
<?php if (AuthComponent::user('id')): ?>
<?= AuthComponent::user('username') ?>
<?php endif; ?>
</span>
</a>
<img src="img/penguen.jpg" class="user-image">
was your mistake.
Leverage the helper to generate "valid" links for you, problem solved:
$this->Html->image('penguen.jpg', ['class' => 'user-image']);
Never use manual a or img tags with manually built URLs, that can only go wrong.

Concrete5: Change link in the header section

I have this div content in my header.php file contained in application/themes/custom_name/elements
<?php defined('C5_EXECUTE') or die("Access Denied.");
$this->inc('elements/header_top.php');
$cl_txt = $c->getAttribute('client_login_txt');
$cl_url = $c->getAttribute('client_login_url');
?>
......
<div class="login">
<a href="<?php echo $cl_url ?>" target="_blank">
<button type="button" class="btn-login"><?php echo $cl_txt ?></button>
</a>
</div>
I would like to change the link contained in the div.
Where can I do it?
There are two Page Attributes, the link URL is called Client Link URL and the link text is called Client Link Text, I was able to edit this by going to Full Sitemap and click on the page I am trying to change and select Attributes.

PHP Fancybox same ID

This may seem like a weird request, but this is something I have to use based on something I have been provided that is live.
I have a voting system that uses an id for the voting button based on the entry id, so the code looks like:
<div class="like_wrap">
<div class="vot_plus" id="vt_img41"></div>
</div><!--like_wrap-->
This works how I need it to, however when you click the image within the vote it opens up a larger picture of the entry (again this works), but the client would like to add that vote to the fancybox popup. However when this is added it removes all references as it is calling the same ID twice. Any idea how I can get the voting button to appear on both, but actually look like it only appears once?
Here is the full code of an entry:
<div class="single ">
<a href='#inline41' rel='example_group' title='NAME GOES HERE'><img src='IMAGE GOES HERE' height='90' width='90' class='image' /></a>
<div class="right_col">
<h3>NAME GOES HERE</h3>
<div class="like_wrap"><div class="vot_plus" id="vt_img41"></div></div><!--like_wrap-->
</div><!--right_col-->
<div class="clear"></div><!--clear-->
<div id="inline41" style="display: none;">
<img src='IMAGE GOES HERE' height='400' class='image' /></a>
<div class="vote_bottom">
<p>Vote: </p>
<div class="like_wrap"><div class="vot_plus" id="vt_img41"></div></div><!--like_wrap-->
<div class="clear"></div><!--clear-->
</div><!--vote_bottom-->
</div>
</div><!--single-->
Any ideas how I can do this?
Thanks.

Categories