Welcome Guest, Not a member yet? Register   Sign In
Issues with code
#1

Hello!

I would like to use this code for profile within my code but I get errors of undefinfed variables. Here is the code:

 <div class="avatar">

                            <img alt="<?php print $this->session->userdata('user_name'); ?>" src="<?php print HTTP_IMAGES_PATH; ?>user-default.jpg">
                        </div>
                    </div>
                    <div class="card-body info">
                        <div class="title">
                            <a href="<?php print site_url() ?>profile"><?php print $userInfo['full_name']; ?></a>
                        </div>
                        <div class="desc"> <a target="_blank" href="<?php print site_url(); ?>"><?php PRINT APPLICATION_NAME; ?></a></div>        
                        <div class="desc"><?php print $userInfo['email']; ?>, <?php print $userInfo['contact_no']; ?></div>      
                        <div class="desc"><?php print $userInfo['address']; ?></div>               

I get errors about the php but dont want to delete them because I feel its important. How do I edit the php inserts so they fit my code?

Heart Heart ,
Mekaboo
Reply
#2

What php error messages do you get, and what are the line numbers they refer to?
Without that information, it's impossible to help you.
Reply
#3

(This post was last modified: 06-12-2019, 03:40 AM by InsiteFX.)

HTTP_IMAGES_PATH
APPLICATION_NAME

Those are variables used in Compass app.

If you want to use those names then you would need to create them using DEFINE.
Then set them to the correct folders etc;
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

(06-11-2019, 10:56 PM)Wouter60 Wrote: What php error messages do you get, and what are the line numbers they refer to?
Without that information, it's impossible to help you.

The error I would get is "Undefined variable" and it went with this line: 

    <a href="<?php print site_url() ?>profile"><?php print $userInfo['full_name']; ?></a>

As well as lines like it. I thought of deleting the php part but O felt it would be wrong of me to do so..
Reply
#5

(06-12-2019, 03:40 AM)InsiteFX Wrote: HTTP_IMAGES_PATH
APPLICATION_NAME

Those are variables used in Compass app.

If you want to use those names then you would need to create them using DEFINE.
Then set them to the correct folders etc;

This helps alot with one of the issues I was facing, thank so very much Heart
Reply
#6

(06-12-2019, 09:47 AM)Mekaboo Wrote:
(06-11-2019, 10:56 PM)Wouter60 Wrote: What php error messages do you get, and what are the line numbers they refer to?
Without that information, it's impossible to help you.

The error I would get is "Undefined variable" and it went with this line:

    <a href="<?php print site_url() ?>profile"><?php print $userInfo['full_name']; ?></a>

As well as lines like it. I thought of deleting the php part but O felt it would be wrong of me to do so..

Can you do this?
PHP Code:
<?php 
var_dump
($userInfo);
?>

Is the error also on this line? If not, what is the content of the variable? Maybe the index 'full_name' is not set. If the error is there, define the variable $userInfo
Reply
#7

(06-13-2019, 06:20 AM)jfri Wrote:
(06-12-2019, 09:47 AM)Mekaboo Wrote:
(06-11-2019, 10:56 PM)Wouter60 Wrote: What php error messages do you get, and what are the line numbers they refer to?
Without that information, it's impossible to help you.

The error I would get is "Undefined variable" and it went with this line:

    <a href="<?php print site_url() ?>profile"><?php print $userInfo['full_name']; ?></a>

As well as lines like it. I thought of deleting the php part but O felt it would be wrong of me to do so..

Can you do this?
PHP Code:
<?php 
var_dump
($userInfo);
?>

Is the error also on this line? If not, what is the content of the variable? Maybe the index 'full_name' is not set. If the error is there, define the variable $userInfo

That's where the error is. I'm going to try your suggestion and see if it works Heart
Reply
#8

Also show the code were your getting $userInfo from.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#9

Thank you all so very much! After some going back and forth I took that code out and decided to try out using Bootstrap Profile cards. Simple and easier to integrate. Thanks again Heart
Reply




Theme © iAndrew 2016 - Forum software by © MyBB